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

Fixes two errors when dealing with an encoded url #7107

Merged
merged 4 commits into from Jan 30, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions changes/7107.bugfix
@@ -0,0 +1 @@
Fix urls containing unicode encoded in hex
2 changes: 1 addition & 1 deletion ckan/lib/helpers.py
Expand Up @@ -655,7 +655,7 @@ def full_current_url() -> str:
@core_helper
def current_url() -> str:
''' Returns current url unquoted'''
return unquote(request.environ['CKAN_CURRENT_URL'])
return request.environ['CKAN_CURRENT_URL']


@core_helper
Expand Down
2 changes: 0 additions & 2 deletions ckan/views/__init__.py
Expand Up @@ -190,8 +190,6 @@ def set_ckan_current_url(environ: Any) -> None:

qs = environ.get(u'QUERY_STRING')
if qs:
# sort out weird encodings
qs = quote(qs, u'')
environ[u'CKAN_CURRENT_URL'] = u'%s?%s' % (path_info, qs)
else:
environ[u'CKAN_CURRENT_URL'] = path_info
4 changes: 2 additions & 2 deletions ckanext/datastore/backend/postgres.py
Expand Up @@ -21,7 +21,7 @@

import six
from urllib.parse import (
urlencode, unquote, urlunparse, parse_qsl, urlparse
urlencode, urlunparse, parse_qsl, urlparse
)
from io import StringIO

Expand Down Expand Up @@ -764,7 +764,7 @@ def _insert_links(data_dict: dict[str, Any], limit: int, offset: int):

# change the offset in the url
parsed = list(urlparse(urlstring))
query = unquote(parsed[4])
query = parsed[4]

arguments = dict(parse_qsl(query))
arguments_start = dict(arguments)
Expand Down