fixed bugs
This commit is contained in:
@@ -481,9 +481,13 @@ def create_app(
|
||||
media_path = service_settings.videos_dir / row["stored_filename"]
|
||||
if not media_path.is_file():
|
||||
raise HTTPException(status_code=404, detail="Stored video file is missing.")
|
||||
media_type = row.get("content_type") or "video/mp4"
|
||||
if not str(media_type).lower().startswith("video/"):
|
||||
guessed = mimetypes.guess_type(str(row.get("stored_filename") or ""))[0]
|
||||
media_type = guessed if guessed and guessed.lower().startswith("video/") else "video/mp4"
|
||||
return FileResponse(
|
||||
media_path,
|
||||
media_type=row["content_type"],
|
||||
media_type=media_type,
|
||||
headers={"Accept-Ranges": "bytes", "Cache-Control": "public, max-age=3600"},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user