Skip to content

Commit

Permalink
only redirect those single strings that start with /
Browse files Browse the repository at this point in the history
  • Loading branch information
Zharktas committed Aug 11, 2017
1 parent 895de2c commit 49a0969
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ckan/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def redirect_to(*args, **kw):
toolkit.redirect_to('http://example.com')
toolkit.redirect_to('/dataset')
toolkit.redirect_to('/some/other/path')
'''
if are_there_flash_messages():
Expand All @@ -172,7 +173,7 @@ def redirect_to(*args, **kw):
matching = [s for s in uargs if any(xs in s for xs in exempt_urls)]

if uargs and len(uargs) is 1 and isinstance(uargs[0], basestring) \
and len(matching) is 0:
and uargs[0].startswith('/') and len(matching) is 0:
return _routes_redirect_to(uargs[0])

_url = url_for(*uargs, **kw)
Expand Down

0 comments on commit 49a0969

Please sign in to comment.