CSV export now respects --cors, fixes #326

This commit is contained in:
Simon Willison 2018-06-23 17:59:37 -07:00
commit 64c2fea8df
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52
3 changed files with 40 additions and 14 deletions

View file

@ -228,6 +228,8 @@ class BaseView(RenderMixin):
content_type = "text/plain; charset=utf-8"
headers = {}
if self.ds.cors:
headers["Access-Control-Allow-Origin"] = "*"
if request.args.get("_dl", None):
content_type = "text/csv; charset=utf-8"
disposition = 'attachment; filename="{}.csv"'.format(