Fix downloaded filename

This commit is contained in:
Paul Bienkowski 2022-02-25 11:52:56 +01:00
parent a884ac88d8
commit 600457fe19
2 changed files with 6 additions and 1 deletions

View file

@ -101,6 +101,7 @@ def setup_cors(app):
app, app,
origins=origins, origins=origins,
supports_credentials=True, supports_credentials=True,
expose_headers={"Content-Disposition"},
) )

View file

@ -207,7 +207,11 @@ async def download_original_file(req, slug: str):
if not track.is_visible_to_private(req.ctx.user): if not track.is_visible_to_private(req.ctx.user):
raise Forbidden() raise Forbidden()
return await file_stream(track.get_original_file_path(req.app.config)) return await file_stream(
track.get_original_file_path(req.app.config),
mime_type="text/csv",
filename=f"{slug}.csv",
)
@api.put("/tracks/<slug:str>") @api.put("/tracks/<slug:str>")