fixed a bug
This commit is contained in:
parent
633d91a11d
commit
99ab7425a5
@ -40,7 +40,8 @@ def thumbnail(id):
|
||||
@bp.route("/titelbild/create/", methods=["POST"])
|
||||
def create():
|
||||
if request.files["form_Titelbild"].filename == "":
|
||||
raise TypeError(message="FileStorage object expected")
|
||||
flash("Konnte Operation nicht ausführen (keine Datei ausgewählt)", "error")
|
||||
return redirect(url_for("titelbild.all"), code=303)
|
||||
blob = request.files["form_Titelbild"].read()
|
||||
|
||||
with BytesIO(blob) as bytes_io:
|
||||
@ -49,7 +50,7 @@ def create():
|
||||
#if db.session.scalar(select(Titelbild).where(Titelbild.sha256 == hashlib.file_digest(bytes_like, "sha256"))):
|
||||
sha256 = makeshift_digest(bytes_io)
|
||||
if db.session.scalar(select(Titelbild).where(Titelbild.sha256 == sha256)):
|
||||
flash("Eintrag ist bereits in Datenbank vorhanden")
|
||||
flash("Eintrag ist bereits in Datenbank vorhanden", "error")
|
||||
return redirect(url_for("titelbild.all"), code=303)
|
||||
|
||||
# get Image and thumbnail
|
||||
|
||||
Loading…
Reference in New Issue
Block a user