findMatchingRedirect does not resolve recursivly, if a redirect contains a fragment.

Created on 9 July 2025, 18 days ago

Problem/Motivation

findMatchingRedirect does not resolve recursivly, if a redirect contains a fragment.

Steps to reproduce

Create redirect:
/a -> /b#223
/b -> /c

$redirect = \Drupal::service('redirect.repository')->findMatchingRedirect('/a');
var_dump($redirect->getRedirectUrl()->toString());

Expected:
/c

Output
/b#223

Proposed resolution

Perhaps `findByRedirect` could strip out the fragment on the recursive check?

$generated_url = $uri->setOption('fragment', NULL)->toString(TRUE);

Which would resolve to:
/a -> /b
/b -> /c

Remaining tasks

TBA

User interface changes

NIL

API changes

NIL

Data model changes

NIL

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇦🇺Australia almunnings Melbourne, 🇦🇺

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024