From 99ab7425a51ff102ecd8464ff4706132287afa48 Mon Sep 17 00:00:00 2001 From: eclipse Date: Sat, 23 Aug 2025 12:06:32 +0200 Subject: [PATCH] fixed a bug --- the_works/views/titelbild.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/the_works/views/titelbild.py b/the_works/views/titelbild.py index 59af8f2..b423357 100644 --- a/the_works/views/titelbild.py +++ b/the_works/views/titelbild.py @@ -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