Encoding issue with path alias search.

Created on 30 March 2023, about 1 year ago
Updated 28 April 2023, about 1 year ago

Problem/Motivation

Trying to translate a encoded path or a path containing a query string, returns a no match error.

Steps to reproduce

If you have a page called /press-releases that translates to /fr/communiqués de presse and then visit this /router/translate-path?path=/fr/communiqués%20de%20presse this will work as expected. If you append a query string, a random cache buster for instance i.e. k=131. You will get a no match.

If you now try visiting /fr/communiqu%C3%A9s%20de%20presse a path that was encoded before submitting the requests from a Drupal Next instance, you will also get a no-match, as it isn't being decoded before doing the alias lookup.

Proposed resolution

By adding something like $path = urldecode(parse_url($path)['path'] ?? $path); to the onPathTranslation method in RouterPathTranslatorSubscriber.php, we're able to resolve this above issue.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇦🇪United Arab Emirates leslie.cordell Dubai

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024