Review main Merged

71610[BUGFIX] Ensure cyrilic work as regexp redirects capture group

Susi Moog CR +2 V +2 Normal +117 −20 updated 10/19/21, 14:00

Commit message

Requests with special characters like for ex.
cyrilic characters in it would be rawurlencoded
by the used Uri() components. Webservers like
Apache normally decodeds them for the php process.

'RedirectService::matchRedirect()' has been
using rawurldecode() to decode the path to work
properly to resolve path with such characters.

RegExp redirects may have capture groups which
should be replaced in the target url for the
redirect. The corresponding replace method has
not been working with urldecoded variant and as
such the encoded value was used.

Furthermore if for ex. cyrilic characters where
in the path, and not only part of the capture
group the seconady preg_match in that replace
method did not matched the regexp which has
matched as redirect. Additional it could be
that cyrilic characters would be used for
the regexp in the query part, if respect
query parameters options is enabled for the
redirect.

This patch adds a rawurldecode() call to decode
the path and query, if needed,  to the method
`RedirectService::replaceRegExpCaptureGroup()`
and covers these cases with unit tests.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 2