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

Ignore %2B in normalize #386

Open
douglara opened this issue Apr 23, 2020 · 7 comments
Open

Ignore %2B in normalize #386

douglara opened this issue Apr 23, 2020 · 7 comments

Comments

@douglara
Copy link

douglara commented Apr 23, 2020

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: #99

Addressable version: 2.7.0

@dentarg
Copy link
Collaborator

dentarg commented Apr 23, 2020

What do you expect to happen? What version of Addressable are you using?

@douglara
Copy link
Author

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!

@dentarg
Copy link
Collaborator

dentarg commented Apr 24, 2020

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)

@douglara
Copy link
Author

What does the URL look like before the first normalize?

Im not normalized, the AWS S3 already delivers the "normalized" link
image
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" 

image

@dentarg
Copy link
Collaborator

dentarg commented Apr 28, 2020

Feels very similar to #366 (in #366 the issue is in the query parameters, not sure how that matters)

mejackreed added a commit to sul-dlss/stacks that referenced this issue Oct 1, 2020
We are removing the default HTTP gem URL normalization because there is
an upstream error which causes issues for `+` characters.

sporkmonger/addressable#386
mejackreed added a commit to sul-dlss/stacks that referenced this issue Oct 1, 2020
We are removing the default HTTP gem URL normalization because there is
an upstream error which causes issues for `+` characters.

sporkmonger/addressable#386
@dentarg
Copy link
Collaborator

dentarg commented Jul 19, 2023

Related: #99 (72bf6c0) made %2B in query strings to be preserved during normalisation

@dentarg
Copy link
Collaborator

dentarg commented Jul 19, 2023

I think this issue is the same as #366 but I'll keep this one open until it has been addressed.

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

No branches or pull requests

2 participants