Explorar el Código

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

tags/1.4.0
sondin hace 6 meses
padre
commit
d70fa2847b
No account linked to committer's email address
Se han modificado 1 ficheros con 14 adiciones y 0 borrados
  1. 14
    0
      api/controllers/files/image_preview.py

+ 14
- 0
api/controllers/files/image_preview.py Ver fichero

@@ -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"]:

Cargando…
Cancelar
Guardar