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

Fix 'TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters' #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Jul 6, 2020

  1. Fix 'TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains

    unescaped characters'
    
    It appears most browsers (tested in Firefox, Safari and
    Chromium[Chrome/Brave]) will url-encode paths automatically if they are
    not already encoded.
    
    `xhr2` doesn't match that behavior when run in node: using an
    unencoded URL will result in `TypeError [ERR_UNESCAPED_CHARACTERS]`.
    
    Just adding the encoding line however causes a new issue; already
    encoded URLs end up being double-encoded, changing the URL incorrectly.
    
    Using [`native-url`](https://github.com/GoogleChromeLabs/native-url
    instead of `url` fixes this, as well as removing the dependency on the
    deprecated [Legacy URL
    API](https://nodejs.org/api/url.html#url_legacy_url_api).
    
    It would have of course been better to refactor `xhr2` to not use the
    deprecated API, however this does not appear to be trivial looking at
    the [`native-url`
    code](https://github.com/GoogleChromeLabs/native-url/tree/master/src).
    supermario committed Jul 6, 2020
    Configuration menu
    Copy the full SHA
    197830a View commit details
    Browse the repository at this point in the history

Commits on Jul 7, 2020

  1. Configuration menu
    Copy the full SHA
    a0286b2 View commit details
    Browse the repository at this point in the history