Merge pull request #763 from tcely/patch-16

Fix an internal server error
This commit is contained in:
meeb 2025-02-24 17:41:12 +11:00 committed by GitHub
commit e7032dccf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -499,8 +499,9 @@ class MediaThumbView(DetailView):
def get(self, request, *args, **kwargs):
media = self.get_object()
if media.thumb:
thumb = open(media.thumb.path, 'rb').read()
if media.thumb_file_exists:
thumb_path = pathlib.Path(media.thumb.path)
thumb = thumb_path.read_bytes()
content_type = 'image/jpeg'
else:
# No thumbnail on disk, return a blank 1x1 gif