Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

add Accept-Ranges header for audio/video files (#19119)

sondind70fa2847bb4
diff --git a/api/controllers/files/image_preview.py b/api/controllers/files/image_preview.py
index 5bb28b3897a..9199069585f 100644
--- a/api/controllers/files/image_preview.py
+++ b/api/controllers/files/image_preview.py
@@ -70,6 +70,20 @@ class FilePreviewApi(Resource):
direct_passthrough=True,
headers={},
)
+ # add Accept-Ranges header for audio/video files
+ if upload_file.mime_type in [
+ "audio/mpeg",
+ "audio/wav",
+ "audio/mp4",
+ "audio/ogg",
+ "audio/flac",
+ "audio/aac",
+ "video/mp4",
+ "video/webm",
+ "video/quicktime",
+ "audio/x-m4a",
+ ]:
+ response.headers["Accept-Ranges"] = "bytes"
if upload_file.size > 0:
response.headers["Content-Length"] = str(upload_file.size)
if args["as_attachment"]: