Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added validation message when invalid url on dataset search query e.g with comma is given #6939

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion ckan/views/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,14 @@ def search(package_type: str) -> str:
if not sort_by:
sort_by_fields = []
else:
sort_by_fields = [field.split()[0] for field in sort_by.split(u',')]
try:
sort_by_fields = [field.split()[0] for field
in sort_by.split(u',')]
except IndexError as e:
log.error(u'Dataset search error: %r', e.args)
extra_vars[u'query_error'] = True
extra_vars[u'search_facets'] = {}
extra_vars[u'page'] = h.Page(collection=[])
extra_vars[u'sort_by_fields'] = sort_by_fields

pager_url = partial(_pager_url, params_nopage, package_type)
Expand Down