mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
--cors for /name.db downloads, refs #1057
This commit is contained in:
parent
e5f5034bcd
commit
c3aba4aa98
4 changed files with 19 additions and 5 deletions
|
|
@ -144,10 +144,14 @@ class DatabaseDownload(DataView):
|
|||
if not db.path:
|
||||
raise DatasetteError("Cannot download database", status=404)
|
||||
filepath = db.path
|
||||
headers = {}
|
||||
if self.ds.cors:
|
||||
headers["Access-Control-Allow-Origin"] = "*"
|
||||
return AsgiFileDownload(
|
||||
filepath,
|
||||
filename=os.path.basename(filepath),
|
||||
content_type="application/octet-stream",
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue