Skip to content

Commit 5a1419d

Browse files
committed
thumbnail: Fix path for thumb output
1 parent bb3e8a1 commit 5a1419d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/classes/thumbnail.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,16 @@ def do_GET(self):
151151

152152
# Locate thumbnail
153153
thumb_path = os.path.join(info.THUMBNAIL_PATH, file_id, "%s.png" % file_frame)
154-
if not os.path.exists(thumb_path) and file_frame == 1:
155-
# Try ID with no frame # (for backwards compatibility)
156-
thumb_path = os.path.join(info.THUMBNAIL_PATH, "%s.png" % file_id)
157-
if not os.path.exists(thumb_path) and file_frame != 1:
158-
# Try with ID and frame # in filename (for backwards compatibility)
159-
thumb_path = os.path.join(info.THUMBNAIL_PATH, "%s-%s.png" % (file_id, file_frame))
154+
if not os.path.exists(thumb_path):
155+
if file_frame == 1:
156+
# Try ID with no frame # (for backwards compatibility)
157+
alt_path = os.path.join(info.THUMBNAIL_PATH, "%s.png" % file_id)
158+
else:
159+
# Try with ID and frame # in filename (for backwards compatibility)
160+
alt_path = os.path.join(info.THUMBNAIL_PATH, "%s-%s.png" % (file_id, file_frame))
161+
162+
if os.path.exists(alt_path):
163+
thumb_path = alt_path
160164

161165
if not os.path.exists(thumb_path):
162166
# Generate thumbnail (since we can't find it)

0 commit comments

Comments
 (0)