changes(backend): return 404 if paste not exist

This commit is contained in:
Ada 2023-09-26 13:46:04 +02:00
parent 4b19713c06
commit df2837d3ff

View file

@ -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)