diff --git a/kanken_online/__init__.py b/kanken_online/__init__.py index 4ae4c23..5925b6c 100644 --- a/kanken_online/__init__.py +++ b/kanken_online/__init__.py @@ -59,6 +59,10 @@ def create_app(test_config=None): pfp = files["pfp"] pfp.save(os.path.join(app.config["PFP_STORE"], stored_filename)) + # Remove old PFP + if settings and settings["pfp"]: + os.remove(os.path.join(app.config["PFP_STORE"], stored_filename)) + db.execute("UPDATE user_settings SET pfp_filename = ?", (stored_filename,)) db.commit()