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

Infinite redirect warning when URL pattern contains encoded # (%23) #218

Open
brandonkelly opened this issue Jan 20, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@brandonkelly
Copy link
Contributor

Describe the bug

Just experienced a weird bug with the Twitter Mac app, where a URL with a hash in it (https://craftcms.com/knowledge-base/configuring-load-balanced-environments#mutex-locks) was getting its hash mark encoded to %23:

https://craftcms.com/knowledge-base/configuring-load-balanced-environments%23mutex-locks

I figured it would be easy enough to add a redirect for that in Retour, however Retour ended up decoding the %23 to #, and then didn’t like how the redirect URL looked identical to the URL pattern, saying it would create an infinite redirect loop.

I ended up working around it by setting the Match Type to regex, and the URL pattern to:

/knowledge-base/configuring-load-balanced-environments.+mutex-locks

Ideally Retour would not be decoding the %23 – if that’s even possible? – and also should not be rejecting matching URL patterns/destination URLs if the pattern contains a #, since the hash would never get sent to the server in the first place.

To reproduce

  1. Go to Retour → Redirects and create a new redirect
  2. Enter /foo%23bar as the URL pattern
  3. Enter /foo#bar as the destination URL
  4. Press Save

Expected behaviour

The redirect should save, with the URL pattern unmodified, and no warnings about redirect loops.

Versions

  • Plugin version: 3.1.69
  • Craft version: 3.7.27
@brandonkelly brandonkelly added the bug Something isn't working label Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant