-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Square brackets in remote_x_url not being handled correctly #199
Comments
If you have time, please investigate a solution. Do they suggest something else as an alternative to URI.encode? |
Closing in favor of: https://github.com/jnicklas/carrierwave/issues#issue/199 I'd like carrierwave to provide an easy way for people to override/improve the url parsing where necessary. |
I'd like to reopen this issue. IMO, carrierwave should not be responsible for escaping and unescaping the url given to it. It should pass it directly to Net::HTTP. If the user is loading urls from a potentially unsafe source, they should choose to escape them. In my case, I am loading urls from a csv from a trusted source. The odd thing here is this: Parses with % escaped values fine:
If I escape already escaped content, it's fine:
If you unescape it then escape it, URI.escape doesn't escape the [] and it crashes:
This is a known bug in ruby but has been rejected for resolution. I propose either:
I'm going to do #2 right now and submit a pull request. We can continue there. |
When attempting to assign a url using the Model.remote_file_url accessor most characters are encoded properly however square brackets are left as they are which generates a URI::InvalidURIError exception:
There is a ruby bug report at http://redmine.ruby-lang.org/issues/show/3457 suggesting that URI.encode should not be used for this purpose.
I have attempted encoding the square brackets directly before handing it off to carrierwave but this appears to end up with double encoding of the % characters.
The text was updated successfully, but these errors were encountered: