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

Conversation

EricSoroos
Copy link
Contributor

@EricSoroos EricSoroos commented Sep 27, 2022

The 2.10 version of #6685
Fixes #6684

  • url in question /%EF%AC%81?foo=bar&bz=%AC%81
  • This is a unicode character, which can't be decoded from
    ascii. Jinja templates will handle this if it's unicode, or if it's
    hex encoded ascii.
  • The querystring was being quoted, which is incorrect, as:
    1. the special characters in the query string mean something
    2. The rest of the querystring is already quoted. This makes it
      double quoted, as seen in the datastore file
  • We don't want to unquote urls before putting them in the template
    anyway.
    The solution here is to make sure it's unicode passed into the
    function.

Features:

  • includes tests covering changes
  • includes updated documentation
  • includes user-visible changes
  • includes API changes
  • includes bugfix for possible backport (backport already applied)

Please [X] all the boxes above that apply

* url in question /%EF%AC%81?foo=bar&bz=%AC%81
* This is a unicode character, which can't be decoded from
ascii. Jinja templates will handle this if it's unicode, or if it's
hex encoded ascii, but can't take a non-unicode string in python 2 and
put this in a template.
* The querystring was being quoted, which is incorrect, as:
  1) the special characters in the query string mean something
  2) The rest of the querystring is already quoted. This makes it
  double quoted, as seen in the datastore file
* We don't want to unquote urls before putting them in the template
anyway.
* There was s further error passing this unicode path to the template
resolution, where in posix path, it fails:
```
File '/usr/lib/ckan/default/lib/python2.7/posixpath.py', line 73 in join
  path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 1: ordinal not in range(128)
```
The solution here is to make sure it's unicode passed into the
function.
@amercader amercader self-assigned this Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helpers.current_url returns inconsistently quoted url, causing 500 errors.
3 participants