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

URL encode the original image #15

Closed
wants to merge 1 commit into from
Closed

Conversation

dannymidnight
Copy link

This fix addresses #13

Without url encoding thumbor will treat the generated url as malformed.

eg.
This is invalid:
http://thumbor.example.com/{hash}=/fit-in/320x240/http://example.com/llamas.jpg

This is valid:
http://thumbor.example.com/{hash}=/fit-in/320x240/http%3A%2F%2Fexample.com%2Fllamas.jpg'

@harto @lwc

Thumbor will treat the generated url as malformed without encoding.
@harto
Copy link
Contributor

harto commented Oct 9, 2014

@dannymidnight we've gone back and forth on the URL-escaping. It depends on the version of Thumbor you use.

Are you absolutely sure the given example is invalid? In my experience, only certain URL characters need encoding. E.g. ~. See #10.

@dannymidnight
Copy link
Author

haha oh man.. I wasn't aware of that discussion.

@harto
Copy link
Contributor

harto commented Oct 9, 2014

Yep, it's confusing. Basically:

  • Our current Thumbor server version needs ~ to be URL-escaped.
  • The latest Thumbor server version handles ~ without URL-escaping.

So, your options are either:

  • escape ~ in the original URL
  • upgrade to a more recent Thumbor server version.

Related: thumbor/thumbor@1693d68

@dannymidnight
Copy link
Author

Does preventing double encoding by urlencode(urldecode($original)) solve the issue for everyone?

@harto
Copy link
Contributor

harto commented Oct 9, 2014

I think urlencode(urldecode($original)) is equivalent to urlencode($original)...

@pda
Copy link

pda commented Oct 9, 2014

Not exactly; each encode or decode adds or removes a layer of encoding.
And decoding is destructive — information about mixed encoding e.g. "one+two three%20four" is lost.

@dannymidnight
Copy link
Author

Aight closing this and rolling with own urlencode within app.

@harto
Copy link
Contributor

harto commented Oct 15, 2014

👍
Happy to help if you need it @dannymidnight

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

Successfully merging this pull request may close these issues.

3 participants