From 2673026880a58c0e6fc1668517da82878209df20 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Fri, 21 Apr 2023 16:20:22 +0000 Subject: [PATCH] Removed cached copies of profile images --- onlylegs/api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/onlylegs/api.py b/onlylegs/api.py index ede4caf..b4b88aa 100644 --- a/onlylegs/api.py +++ b/onlylegs/api.py @@ -224,6 +224,10 @@ def user_picture(user_id): if user.picture: os.remove(os.path.join(current_app.config["PFP_FOLDER"], user.picture)) + # Delete cached files + cache_name = user.picture.rsplit(".")[0] + for cache_file in pathlib.Path(current_app.config["CACHE_FOLDER"]).glob(cache_name + "*"): + os.remove(cache_file) # Save file try: