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,
|
||||
render_template,
|
||||
request,
|
||||
url_for,
|
||||
url_for, abort,
|
||||
)
|
||||
from werkzeug import Response
|
||||
|
||||
|
@ -60,5 +60,9 @@ def get_content(path: str) -> str:
|
|||
:return: Paste content.
|
||||
"""
|
||||
db = connect_redis()
|
||||
flash(db.get(path))
|
||||
return render_template("content.html.j2")
|
||||
data = db.get(path)
|
||||
if check_content_exist(path):
|
||||
flash(data)
|
||||
return render_template("content.html.j2")
|
||||
else:
|
||||
abort(404)
|
||||
|
|
Reference in a new issue