From 600457fe191c247b24e404bfc7b8f640815400fd Mon Sep 17 00:00:00 2001 From: Paul Bienkowski Date: Fri, 25 Feb 2022 11:52:56 +0100 Subject: [PATCH] Fix downloaded filename --- api/obs/api/app.py | 1 + api/obs/api/routes/tracks.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/api/obs/api/app.py b/api/obs/api/app.py index 0fe34e2..c378c42 100644 --- a/api/obs/api/app.py +++ b/api/obs/api/app.py @@ -101,6 +101,7 @@ def setup_cors(app): app, origins=origins, supports_credentials=True, + expose_headers={"Content-Disposition"}, ) diff --git a/api/obs/api/routes/tracks.py b/api/obs/api/routes/tracks.py index 6abe794..d2cdbef 100644 --- a/api/obs/api/routes/tracks.py +++ b/api/obs/api/routes/tracks.py @@ -207,7 +207,11 @@ async def download_original_file(req, slug: str): if not track.is_visible_to_private(req.ctx.user): 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/")