kopia lustrzana https://github.com/simonw/datasette
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/1194cleaner-link-column-pass-tests
rodzic
1f384e662b
commit
5ebc7137d7
|
@ -457,9 +457,9 @@ class DatabaseDownload(BaseView):
|
||||||
async def view_get(self, request, name, hash, **kwargs):
|
async def view_get(self, request, name, hash, **kwargs):
|
||||||
filepath = self.ds.inspect()[name]['file']
|
filepath = self.ds.inspect()[name]['file']
|
||||||
return await response.file_stream(
|
return await response.file_stream(
|
||||||
filepath, headers={
|
filepath,
|
||||||
'Content-Disposition': 'attachment; filename="{}"'.format(filepath)
|
filename=os.path.basename(filepath),
|
||||||
}
|
mime_type='application/octet-stream',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue