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
This commit is contained in:
Simon Willison 2018-04-17 17:31:54 -07:00
commit 5ebc7137d7
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52

View file

@ -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',
)