Fix preview retrieval to handle missing previews gracefully (#22331)

This commit is contained in:
Josh Hawkins 2026-03-08 15:14:44 -05:00 committed by GitHub
parent 4e71a835cb
commit bde518e861
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1531,6 +1531,7 @@ def preview_gif(
):
if datetime.fromtimestamp(start_ts) < datetime.now().replace(minute=0, second=0):
# has preview mp4
try:
preview: Previews = (
Previews.select(
Previews.camera,
@ -1548,8 +1549,7 @@ def preview_gif(
.limit(1)
.get()
)
if not preview:
except DoesNotExist:
return JSONResponse(
content={"success": False, "message": "Preview not found"},
status_code=404,