Issue Bug New Orphaned

#104179inconsistent url encoding in redirects

Mordamir 06/21/24, 15:37 updated 06/21/24, 15:37

Description

I think there is a bug with inconsistent url encoding inside the redirect extension.

I want to match an url with parameters like url?foo[bar]=42
So i use #^/url\?foo%5Bbar%5D=([0-9]+)# as regex and as new target /path2/$1

The thing is, this will not work and outputs the target path without replacements.

After some debugging i found out that the url is first matched with the urldecoded version “url?foo%5Bbar%5D=42”.
But for the later preg_match which generates the capture groups to build the target uri, it is matched against “url?foo[bar]=42”.

As a workaround i now use as regex #^/url\?foo(?:%5B|\[)bar(?:%5D|\]=([0-9]+)# which matches in both cases.

I found a related task #94934 which introduced this change.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] inconsistent url encoding in redirects Resolves: #104179 Releases: main