From 5ebc7137d736d8fa47b24cc799fb93909f49cabb Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Tue, 17 Apr 2018 17:31:54 -0700 Subject: [PATCH] Use application/octet-stream for downloadable databses I'd also like to send the Content-Length here but that's not currently possible in Sanic - see bug report here: https://github.com/channelcat/sanic/issues/1194 --- datasette/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/datasette/app.py b/datasette/app.py index e09e4fa5..da40df1e 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -457,9 +457,9 @@ class DatabaseDownload(BaseView): async def view_get(self, request, name, hash, **kwargs): filepath = self.ds.inspect()[name]['file'] return await response.file_stream( - filepath, headers={ - 'Content-Disposition': 'attachment; filename="{}"'.format(filepath) - } + filepath, + filename=os.path.basename(filepath), + mime_type='application/octet-stream', )