-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
🐛 Fixed redirects with special characters #15533
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Prathamesh010, thanks for your PR!
I believe that this should be handled inside the redirect manager itself?
I think that will also make it easier to add unit tests that demonstrate the change is correct, which we would need in order to safely merge this please.
refs/closes # custom redirect urls with special characters showing 404 instead of redirection this was because of the urls not being encoded before adding to the router
Codecov ReportBase: 52.32% // Head: 52.32% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #15533 +/- ##
=======================================
Coverage 52.32% 52.32%
=======================================
Files 1446 1446
Lines 93505 93512 +7
Branches 10439 10439
=======================================
+ Hits 48928 48933 +5
Misses 43350 43350
- Partials 1227 1229 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Hi @Prathamesh010 thanks so much for taking the time to create and update this PR. The updated solution looks great 👌 This has now been merged 🎉 and will appear in the next release of Ghost - usually Fridays. I'm not sure if you found this through hacktoberfest, but I've added the accepted label to this PR to make sure it counts. We have plenty of open issues and ongoing projects for hacktoberfest and beyond, including a project around i18n and there was also a recent discussion about adding support for special characters in more key parts of Ghost that I can reopen if it's interesting to you as we're looking for experts to take on this work and help us make sure it doesn't break anything 🙂 |
closes: #15267 - This was because the URLs were not being encoded and matched correctly - it is solved by encoding the URL before adding to the router.
refs/closes #15267
Custom redirect URLs with special characters showing 404 instead of redirection
This was because the URLs were not being encoded before adding to the router.
yarn test:all
andyarn lint
)The issue is solved by encoding the URL before its added to the router.
Here, the first one resolves perfectly as it does not have any special characters but the second one fails to redirect.
I tried adding the encoded version of
/joloonii-surgaltuud/а-ангилал/
ie./joloonii-surgaltuud/%D0%B0-%D0%B0%D0%BD%D0%B3%D0%B8%D0%BB%D0%B0%D0%BB
into the yaml and it resolved perfectly.So the issue was in encoding as
/joloonii-surgaltuud/а-ангилал/
never existed on the router but the encoded one did.