changes(backend): return 404 if paste not exist
This commit is contained in:
parent
4b19713c06
commit
df2837d3ff
1 changed files with 7 additions and 3 deletions
|
@ -5,7 +5,7 @@ from flask import (
|
||||||
redirect,
|
redirect,
|
||||||
render_template,
|
render_template,
|
||||||
request,
|
request,
|
||||||
url_for,
|
url_for, abort,
|
||||||
)
|
)
|
||||||
from werkzeug import Response
|
from werkzeug import Response
|
||||||
|
|
||||||
|
@ -60,5 +60,9 @@ def get_content(path: str) -> str:
|
||||||
:return: Paste content.
|
:return: Paste content.
|
||||||
"""
|
"""
|
||||||
db = connect_redis()
|
db = connect_redis()
|
||||||
flash(db.get(path))
|
data = db.get(path)
|
||||||
|
if check_content_exist(path):
|
||||||
|
flash(data)
|
||||||
return render_template("content.html.j2")
|
return render_template("content.html.j2")
|
||||||
|
else:
|
||||||
|
abort(404)
|
||||||
|
|
Reference in a new issue