From 477c61c4b686d2cbb331b51894731765eff8cd55 Mon Sep 17 00:00:00 2001 From: Kiril Kovachev Date: Sat, 19 Oct 2024 18:16:10 +0100 Subject: [PATCH] Ensure PFP is not empty before uploading --- kanken_online/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kanken_online/__init__.py b/kanken_online/__init__.py index f84a71f..d926b89 100644 --- a/kanken_online/__init__.py +++ b/kanken_online/__init__.py @@ -56,7 +56,7 @@ def create_app(test_config=None): db.execute("INSERT INTO user_settings (user_id, lang, theme) VALUES (?, ?, ?)", (session["user_id"], form["language"], form["theme"])) - if "pfp" in files: + if "pfp" in files and files["pfp"].filename != "": stored_filename = str(uuid.uuid4()) pfp = files["pfp"] pfp.save(os.path.join(app.config["PFP_STORE"], stored_filename))