Skip to content

Commit

Permalink
thumbnail: Fix path for thumb output
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Nov 20, 2019
1 parent bb3e8a1 commit 5a1419d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/classes/thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,16 @@ def do_GET(self):

# Locate thumbnail
thumb_path = os.path.join(info.THUMBNAIL_PATH, file_id, "%s.png" % file_frame)
if not os.path.exists(thumb_path) and file_frame == 1:
# Try ID with no frame # (for backwards compatibility)
thumb_path = os.path.join(info.THUMBNAIL_PATH, "%s.png" % file_id)
if not os.path.exists(thumb_path) and file_frame != 1:
# Try with ID and frame # in filename (for backwards compatibility)
thumb_path = os.path.join(info.THUMBNAIL_PATH, "%s-%s.png" % (file_id, file_frame))
if not os.path.exists(thumb_path):
if file_frame == 1:
# Try ID with no frame # (for backwards compatibility)
alt_path = os.path.join(info.THUMBNAIL_PATH, "%s.png" % file_id)
else:
# Try with ID and frame # in filename (for backwards compatibility)
alt_path = os.path.join(info.THUMBNAIL_PATH, "%s-%s.png" % (file_id, file_frame))

if os.path.exists(alt_path):
thumb_path = alt_path

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

0 comments on commit 5a1419d

Please sign in to comment.