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

Using encodeURI breaks some URLs #191

Open
codeclown opened this issue Dec 23, 2018 · 1 comment
Open

Using encodeURI breaks some URLs #191

codeclown opened this issue Dec 23, 2018 · 1 comment

Comments

@codeclown
Copy link
Sponsor

Background:

Since PR #103 URLs are passed through encodeURI in get.js:

request(encodeURI(url), settings, function response(error, res, body) {

Problem:

This can result in 404s for otherwise working URLs. Example:

<img src="http://example.com/img/ExampleImage%20Space.png" />

Passing it through encodeURI turns the encoded space character %20 into %2520:

encodeURI('http://example.com/img/ExampleImage%20Space.png')
"http://example.com/img/ExampleImage%2520Space.png"

Which breaks the URL, and now we get a 404 for the image when trying to inline it.

@codeclown codeclown changed the title Using encodeURI in get.js breaks some URLs Using encodeURI breaks some URLs Dec 23, 2018
@codeclown
Copy link
Sponsor Author

PR made: #192


Anyone bumping into this issue could use my branch for the time being:

yarn add https://github.com/codeclown/inliner.git#encoded-space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant