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

Combination of underscore and dash incorrectly redirects #871

Open
jericjan opened this issue Jul 16, 2024 · 3 comments
Open

Combination of underscore and dash incorrectly redirects #871

jericjan opened this issue Jul 16, 2024 · 3 comments

Comments

@jericjan
Copy link

I'll have a URL like this:
https://api.memegen.link/images/vince/a/_.b/c-d.png

But then it just collapses and turn into this:
https://api.memegen.link/images/vince/a.b/c_d.png

These work fine tho:
https://api.memegen.link/images/vince/a/.b/c-d.png
https://api.memegen.link/images/vince/a/_b/c-d.png

What is this behavior? Is it just how the browser handles URLs or is it something on memegen's side?

@jacebrowning
Copy link
Owner

jacebrowning commented Jul 16, 2024

Underscores and dashes are used to represent spaces in URLs: https://github.com/jacebrowning/memegen?tab=readme-ov-file#special-characters

That said, seeing a/_.b be changed to a.b is unusual. What text were you expecting to see in each cell of that meme?


FYI, using the POST endpoint will generated URLs with special characters escaped:

curl -X 'POST' \
  'https://api.memegen.link/templates/vince' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"text": ["a","_.b","c-d"]}'

@jericjan
Copy link
Author

Sorry for the late response. I was expecting "A" in the first box, ".b" in the second, then "C d" in the third one. Either way, I suppose nothing's wrong with removing the leading space on the second box. I just want to know what's up with the URL collapsing.

@jacebrowning
Copy link
Owner

I'm going to keep this open as a bug.

http://localhost:5000/images/vince/a/_.b/c_d.png looks correct but http://localhost:5000/images/vince/a/_.b/c-d.png incorrectly redirects.

@jacebrowning jacebrowning reopened this Jul 20, 2024
@jacebrowning jacebrowning changed the title Very specific bug with special characters Combination of underscore and dash incorrectly redirects Jul 20, 2024
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