mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-15 22:40:40 +03:00
Fix non-ASCII characters in project names
This commit is contained in:
parent
4a059be480
commit
e817228280
@ -380,7 +380,13 @@ async def export_project(
|
||||
except (ValueError, OSError, RuntimeError) as e:
|
||||
raise ConnectionError(f"Cannot export project: {e}")
|
||||
|
||||
headers = {"CONTENT-DISPOSITION": f'attachment; filename="{project.name}.gns3project"'}
|
||||
fallback = project.name.encode("ascii", "ignore").decode() or "project"
|
||||
encoded = urllib.parse.quote(project.name, safe="")
|
||||
headers = {
|
||||
"Content-Disposition": (
|
||||
f'attachment; filename="{fallback}.gns3project"; filename*=UTF-8\'\'{encoded}.gns3project'
|
||||
)
|
||||
}
|
||||
return StreamingResponse(streamer(), media_type="application/gns3project", headers=headers)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user