You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2020/11/25 11:05:48 UTC

[incubator-superset] branch master updated: fix: attachment filename error in sqllab with i18n (#11762)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new ac0dd3f  fix: attachment filename error in sqllab with i18n (#11762)
ac0dd3f is described below

commit ac0dd3fa32a2076f00f0fe6d4f276db27aaa2f46
Author: auxten <au...@users.noreply.github.com>
AuthorDate: Wed Nov 25 19:05:30 2020 +0800

    fix: attachment filename error in sqllab with i18n (#11762)
    
    * Fix attachment filename error in sqllab
    
    * Fix line too long lint
    
    * Fix black lint
---
 superset/views/core.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/superset/views/core.py b/superset/views/core.py
index e5730e5..a898faf 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -2474,9 +2474,11 @@ class Superset(BaseSupersetView):  # pylint: disable=too-many-public-methods
             # TODO(bkyryliuk): add compression=gzip for big files.
             csv = df.to_csv(index=False, **config["CSV_EXPORT"])
         response = Response(csv, mimetype="text/csv")
-        response.headers[
-            "Content-Disposition"
-        ] = f"attachment; filename={query.name}.csv"
+        quoted_csv_name = parse.quote(query.name)
+        response.headers["Content-Disposition"] = (
+            f'attachment; filename="{quoted_csv_name}.csv"; '
+            f"filename*=UTF-8''{quoted_csv_name}.csv"
+        )
         event_info = {
             "event_type": "data_export",
             "client_id": client_id,