Ensure PFP is not empty before uploading

This commit is contained in:
Kiril Kovachev 2024-10-19 18:16:10 +01:00
parent 197a5ab242
commit 477c61c4b6

View File

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