[HOTFIX] Update content-disposition headers

This commit is contained in:
Georges-Antoine Assi
2025-04-03 13:04:59 -04:00
parent 67a5836d38
commit fcdfcadf61
2 changed files with 8 additions and 8 deletions

View File

@@ -244,7 +244,7 @@ async def head_rom_content(
path=rom_path,
filename=file.file_name,
headers={
"Content-Disposition": f'attachment; filename="{quote(file.file_name)}"',
"Content-Disposition": f"attachment; filename*=UTF-8''{quote(file.file_name)}; filename=\"{quote(file.file_name)}\"",
"Content-Type": "application/octet-stream",
"Content-Length": str(file.file_size_bytes),
},
@@ -253,7 +253,7 @@ async def head_rom_content(
return Response(
headers={
"Content-Type": "application/zip",
"Content-Disposition": f'attachment; filename="{quote(file_name)}.zip"',
"Content-Disposition": f"attachment; filename*=UTF-8''{quote(file_name)}.zip; filename=\"{quote(file_name)}.zip\"",
},
)
@@ -266,7 +266,7 @@ async def head_rom_content(
return Response(
media_type="application/zip",
headers={
"Content-Disposition": f'attachment; filename="{quote(file_name)}.zip"',
"Content-Disposition": f"attachment; filename*=UTF-8''{quote(file_name)}.zip; filename=\"{quote(file_name)}.zip\"",
},
)
@@ -324,7 +324,7 @@ async def get_rom_content(
path=rom_path,
filename=file.file_name,
headers={
"Content-Disposition": f'attachment; filename="{quote(file.file_name)}"',
"Content-Disposition": f"attachment; filename*=UTF-8''{quote(file.file_name)}; filename=\"{quote(file.file_name)}\"",
"Content-Type": "application/octet-stream",
"Content-Length": str(file.file_size_bytes),
},
@@ -382,7 +382,7 @@ async def get_rom_content(
content=zip_data,
media_type="application/zip",
headers={
"Content-Disposition": f'attachment; filename="{quote(file_name)}.zip"',
"Content-Disposition": f"attachment; filename*=UTF-8''{quote(file_name)}.zip; filename=\"{quote(file_name)}.zip\"",
},
)
@@ -850,7 +850,7 @@ async def get_romfile_content(
path=rom_path,
filename=file_name,
headers={
"Content-Disposition": f'attachment; filename="{quote(file_name)}"',
"Content-Disposition": f"attachment; filename*=UTF-8''{quote(file_name)}; filename=\"{quote(file_name)}\"",
"Content-Type": "application/octet-stream",
"Content-Length": str(file.file_size_bytes),
},

View File

@@ -43,7 +43,7 @@ class ZipResponse(Response):
kwargs["content"] = "\n".join(str(line) for line in content_lines)
kwargs.setdefault("headers", {}).update(
{
"Content-Disposition": f'attachment; filename="{filename}"',
"Content-Disposition": f"attachment; filename*=UTF-8''{filename}; filename=\"{filename}\"",
"X-Archive-Files": "zip",
}
)
@@ -67,7 +67,7 @@ class FileRedirectResponse(Response):
filename = filename or download_path.name
kwargs.setdefault("headers", {}).update(
{
"Content-Disposition": f'attachment; filename="{quote(filename)}"',
"Content-Disposition": f"attachment; filename*=UTF-8''{quote(filename)}; filename=\"{quote(filename)}\"",
"X-Accel-Redirect": quote(str(download_path)),
}
)