From 9f09c40ee25c8af85599d570c3a9635be1953c2d Mon Sep 17 00:00:00 2001
From: Fluffy-Bean <michal-gdula@protonmail.com>
Date: Fri, 21 Apr 2023 13:33:32 +0000
Subject: [PATCH] Incorrect checking of image location

---
 onlylegs/utils/generate_image.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/onlylegs/utils/generate_image.py b/onlylegs/utils/generate_image.py
index 10e2f50..9710795 100644
--- a/onlylegs/utils/generate_image.py
+++ b/onlylegs/utils/generate_image.py
@@ -45,11 +45,11 @@ def generate_thumbnail(file_path, resolution, ext=None):
         return os.path.join(CACHE_FOLDER, f"{file_name}_{res_x}x{res_y}.{ext}")
 
     # Check if image exists in the uploads directory
-    if not os.path.exists(os.path.join(MEDIA_FOLDER, file_path, f"{file_name}.{file_ext}")):
+    if not os.path.exists(os.path.join(MEDIA_FOLDER, file_path)):
         return None
 
     # Open image and rotate it based on EXIF data and get ICC profile so colors are correct
-    image = Image.open(os.path.join(MEDIA_FOLDER, file_path, f"{file_name}.{file_ext}"))
+    image = Image.open(os.path.join(MEDIA_FOLDER, file_path))
     image_icc = image.info.get("icc_profile")
     img_x, img_y = image.size