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

URLs that use %2B are converted to + #2530

Open
RadGH opened this issue Jun 20, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@RadGH
Copy link

commented Jun 20, 2019

Describe the bug
I am using ShareX to take screenshots, which upload to Amazon S3, and then a short link is created with YOURLs. This works fine most of the time.

When I take a screenshot of Notepad++, the filename that is generated looks like:
notepad++_2019-06-19_18-29-56.png

On Amazon S3, the URL encodes the plus signs as %2B:
https://xxx.amazonaws.com/xxx/ShareX/2019/06/notepad%2B%2B_2019-06-19_18-29-56.png

When that URL is sent to YOURLs, the plus signs are converted back:
https://xxx.amazonaws.com/xxx/ShareX/2019/06/notepad++_2019-06-19_18-29-56.png

You can also test this quickly by adding your own short URL in the admin area. It doesn't have to be a real URL, for example: https://radleysustaire.com/testing%2B gets converted to https://radleysustaire.com/testing+

I created a small plugin to fix the problem, although this would break any URLs which DO use a literal plus sign:

yourls_add_filter( 'sanitize_url', 'rs_escape_plus_signs' );
function rs_escape_plus_signs( $in ) {
	return str_replace('+', '%2B', $in);
}

To Reproduce

  1. Create a shorturl for "https://radleysustaire.com/testing%2B"
  2. Notice it changes to "https://radleysustaire.com/testing+"
  3. For some hosts this is probably not an issue, but for amazon s3 it results in an error.

Expected behavior
Keep the original url with %2B

Actual behavior
The url changes to +

Screenshots
Example of the problem: https://s3-us-west-2.amazonaws.com/elasticbeanstalk-us-west-2-868470985522/ShareX/2019/06/notepad++_2019-06-19_18-29-56.png

What it should be: https://s3-us-west-2.amazonaws.com/elasticbeanstalk-us-west-2-868470985522/ShareX/2019/06/notepad%2B%2B_2019-06-19_18-29-56.png

Versions
1.7.3 - I just updated to test, problem still exists

@RadGH RadGH added the bug label Jun 20, 2019

@LeoColomb

This comment has been minimized.

Copy link
Member

commented Jun 24, 2019

When that URL is sent to YOURLs

The URL should be sent encoded. I mean %2B should be encoded, that value is %252B.
How do you send the URL to YOURLS?

@LeoColomb LeoColomb added encoding bug and removed bug labels Jun 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.