Never send a video as its own gallery card

When a video's first frame could not be read (a broken file, no decoder)
the card's thumbnail route served the whole video as the picture. It now
gets the same SVG placeholder with its size as a picture with no card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DemonGatanjieu
2026-10-29 14:43:42 +08:00
co-authored by Claude Opus 5.5
parent 88eaa77472
commit efe281c757
4 changed files with 22 additions and 6 deletions
+3 -3
View File
@@ -159,9 +159,9 @@ async def api_output_thumbnail(request):
if served is None:
return picture_placeholder(file_path)
elif ext in CARD_POSTER_VIDEO_EXTENSIONS:
poster = await asyncio.to_thread(_build_video_poster, file_path)
if poster:
served = poster
served = await asyncio.to_thread(_build_video_poster, file_path)
if not served: # no first frame (a broken file, no decoder): never the video itself as a picture
return picture_placeholder(file_path)
# Revalidate (cheap 304s): an output file can be replaced under the same name.
return web.FileResponse(served, headers={'Cache-Control': 'no-cache'})