Skip to content

Commit

Permalink
Fix: Cannot refresh if a query name contain control characters. (#5602)
Browse files Browse the repository at this point in the history
  • Loading branch information
iwakiriK authored Aug 23, 2023
1 parent 1af49e9 commit 5eeeb5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion redash/handlers/query_results.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import unicodedata
from urllib.parse import quote

import regex
from flask import make_response, request
from flask_login import current_user
from flask_restful import abort
Expand Down Expand Up @@ -115,7 +116,8 @@ def run_query(query, parameters, data_source, query_id, should_apply_auto_limit,
def get_download_filename(query_result, query, filetype):
retrieved_at = query_result.retrieved_at.strftime("%Y_%m_%d")
if query:
filename = to_filename(query.name) if query.name != "" else str(query.id)
query_name = regex.sub(r"\p{C}", "", query.name)
filename = to_filename(query_name) if query_name != "" else str(query.id)
else:
filename = str(query_result.id)
return "{}_{}.{}".format(filename, retrieved_at, filetype)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ python-dotenv==0.19.2
pytz>=2019.3
PyYAML==6.0.1
redis==4.4.4
regex==2023.8.8
requests==2.31.0
RestrictedPython==6.1
rq==1.5.0
Expand Down

0 comments on commit 5eeeb5c

Please sign in to comment.