mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-16 19:45:52 +08:00
add Accept-Ranges header for audio/video files (#19119)
This commit is contained in:
parent
8bf3f5ea78
commit
d70fa2847b
@ -70,6 +70,20 @@ class FilePreviewApi(Resource):
|
|||||||
direct_passthrough=True,
|
direct_passthrough=True,
|
||||||
headers={},
|
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:
|
if upload_file.size > 0:
|
||||||
response.headers["Content-Length"] = str(upload_file.size)
|
response.headers["Content-Length"] = str(upload_file.size)
|
||||||
if args["as_attachment"]:
|
if args["as_attachment"]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user