Language-prefixed alias paths cannot be correctly routed inside a request

Created on 12 October 2022, about 2 years ago
Updated 11 July 2024, 4 months ago

Problem/Motivation

If the route matcher service is used and a language-prefixed path alias is passed to it, then the language inbound processor will remove the langcode of the path and the path will be passed to the path alias manager without a langcode. That creates an issue if the same path alias is configured for two different pages for two different languages and we will never be able to correctly route one of the paths. See "Steps to reproduce" for an use case with the menu system.

Steps to reproduce

1. Create two nodes - one in English and one in German and setup for both the path alias "my-path-alias".
2. Configure your site to use language detection with path prefixes - en and de respectively.
3. Create two main navigation menus - one for English and one for German.
4. While on the English language page - example.com/en - create one menu item in both of the menus and use en/my-path-alias and de/my-path-alias respectively for the link.
5. Observe that on the menu overview page for German the link for the menu item is pointing to the English node.

The only workaround is to always create/edit menu items for a specific language only while being on the page for that language. Or in another words create/edit menu items for the German menu only while being on example.com/de and not on example.com/en.

Proposed resolution

1. When the LanguageNegotiationUrl inbound path processor strips down the language prefix it should add it as an attribute on the request object.
2. The AliasPathProcessor inbound path processor should use the langcode set on the request when querying the path.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
RoutingΒ  β†’

Last updated about 9 hours ago

Created by

πŸ‡©πŸ‡ͺGermany hchonov πŸ‡ͺπŸ‡ΊπŸ‡©πŸ‡ͺπŸ‡§πŸ‡¬

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024