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

This commit is contained in:
Josh Hawkins
2026-03-08 14:14:44 -06:00
committed by GitHub
parent 4e71a835cb
commit bde518e861
+2 -2
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,