fix(#13734): Properly escape special characters in CSV output (#13735)

* fix: Escape csv content during downloads

* Reuse CsvResponse object

* Use correct mimetype for csv responses

* Ensure that headers are also escaped

* Update escaping logic
This commit is contained in:
Ben Reinhart
2021-03-26 15:22:00 -07:00
committed by GitHub
parent 5842cb1b12
commit 55ba47ec2e
7 changed files with 160 additions and 21 deletions

View File

@@ -484,12 +484,7 @@ class ChartRestApi(BaseSupersetModelRestApi):
if result_format == ChartDataResultFormat.CSV:
# return the first result
data = result["queries"][0]["data"]
return CsvResponse(
data,
status=200,
headers=generate_download_headers("csv"),
mimetype="application/csv",
)
return CsvResponse(data, headers=generate_download_headers("csv"))
if result_format == ChartDataResultFormat.JSON:
response_data = simplejson.dumps(