From 5e69c6b8e92e60bfe1096e6cf6acc32a51ae19ca Mon Sep 17 00:00:00 2001 From: Luigi Marini Date: Wed, 18 Mar 2026 15:28:48 -0500 Subject: [PATCH] Set mime type for downloaded file. --- backend/app/routers/files.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/app/routers/files.py b/backend/app/routers/files.py index a9eaf678d..924f16e4a 100644 --- a/backend/app/routers/files.py +++ b/backend/app/routers/files.py @@ -349,8 +349,12 @@ async def download_file( content = fs.get_object(settings.MINIO_BUCKET_NAME, bytes_file_id) # Get content type & open file stream + media_type = file.content_type.content_type + if media_type == "N/A": + media_type = "application/octet-stream" response = StreamingResponse( - content.stream(settings.MINIO_UPLOAD_CHUNK_SIZE) + content.stream(settings.MINIO_UPLOAD_CHUNK_SIZE), + media_type=media_type, ) response.headers["Content-Disposition"] = ( "attachment; filename=%s" % file.name