Skip to content

Commit

Permalink
Fix/apostrophe in filters (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpolidori committed Oct 1, 2021
1 parent 027c431 commit 5cfbeb9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
16 changes: 14 additions & 2 deletions ckanext/querytool/fanstatic/javascript/dist/modules/viz-preview.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions ckanext/querytool/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,14 @@ def get_resource_data(sql_string):
if not c.userobj or get_is_admin_or_editor_of_any_group(c.userobj):
context['ignore_auth'] = True

# We need to un-escape the "&" replacement or else charts won't render
if '\\0026' in sql_string:
sql_string = sql_string.replace('\\0026', '&')

response = toolkit.get_action('datastore_search_sql')(
{}, {'sql': sql_string}
)

records_to_lower = []
for record in response['records']:
records_to_lower.append({k.lower(): v for k, v in record.items()})
Expand Down

0 comments on commit 5cfbeb9

Please sign in to comment.