Open douglara opened 4 years ago
What do you expect to happen? What version of Addressable are you using?
What do you expect to happen? What version of Addressable are you using?
Sorry forgot to add the version but it is the most recent: 2.7.0
I passed him an already normalized url, my expectation would be that he would do nothing but he is removing characteres '%2B' and invalidating my url.
Please correct me if I'm wrong, thanks!
What does the URL look like before the first normalize? Did you normalize it with Addressable?
Please share a complete code example (see https://guides.github.com/features/mastering-markdown/#examples for how to format code)
What does the URL look like before the first normalize?
Im not normalized, the AWS S3 already delivers the "normalized" link Valid link: https://melianuncios-generic-s3-development.s3.us-east-2.amazonaws.com/dmfacessorios/MONITOR+FIXO%2BSENSOR+PRATA.jpg
Did you normalize it with Addressable?
Im not changed the original link.
Please share a complete code example (see https://guides.github.com/features/mastering-markdown/#examples for how to format code)
valid_url = 'https://melianuncios-generic-s3-development.s3.us-east-2.amazonaws.com/dmfacessorios/MONITOR+FIXO%2BSENSOR+PRATA.jpg'
invalid_url = Addressable::URI.parse(valid_url).normalize.to_s
invalid_url => "https://melianuncios-generic-s3-development.s3.us-east-2.amazonaws.com/dmfacessorios/MONITOR+FIXO+SENSOR+PRATA.jpg"
Feels very similar to #366 (in #366 the issue is in the query parameters, not sure how that matters)
Related: #99 (https://github.com/sporkmonger/addressable/commit/72bf6c014d5844c87a83a955807d56f2f445d1f0) made %2B
in query strings to be preserved during normalisation
I think this issue is the same as https://github.com/sporkmonger/addressable/issues/366 but I'll keep this one open until it has been addressed.
When passing a string that contains '%2B' the normalize method remove '%2B'
Example:
url = 'https://melianuncios-generic-s3-development.s3.us-east-2.amazonaws.com/dmfacessorios/MONITOR+FIXO%2BSENSOR+PRATA.jpg' Addressable::URI.parse(url).normalize.to_s
Return: "https://melianuncios-generic-s3-development.s3.us-east-2.amazonaws.com/dmfacessorios/MONITOR+FIXO+SENSOR+PRATA.jpg"I found this PR related: https://github.com/sporkmonger/addressable/pull/99
Addressable version: 2.7.0