Skip to content

Commit

Permalink
Added validation message when invalid url on dataset search query e.g…
Browse files Browse the repository at this point in the history
…. with comma is given

fixed linting & type issues
  • Loading branch information
hussnainwithss committed Jun 25, 2022
1 parent bfcc375 commit 8a6b2b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ckan/views/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,11 @@ 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:
base.abort(400, _(u'Invalid Request'))
extra_vars[u'sort_by_fields'] = sort_by_fields

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

0 comments on commit 8a6b2b1

Please sign in to comment.