When getAliasByPath is called, allow it to add the language path prefix for unaliased paths

Created on 26 July 2016, about 8 years ago
Updated 10 July 2024, about 2 months ago

In AliasManager.php on lines 198, 231 and 248 (Drupal 8.1.1 src -- line numbers might differ in other versions), there's return $path.

This happens in certain cases, for example, if the path has no alias, or if the path is not in the whitelist. While this is OK, the path returned doesn't contain the current language, or the language passed in by parameter to the method.

As a result, calling:

\Drupal::service('path.alias_manager')->getAliasByPath('/taxonomy/term/1', 'fr');

results in an URL like:

/taxonomy/term/1

while the correct path should be:

/fr/taxonomy/term/1

(assuming there is no alias created for that path)

πŸ› Bug report
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component
RoutingΒ  β†’

Last updated 8 days ago

Created by

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

Comments & Activities

Not all content is available!

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

  • πŸ‡¬πŸ‡§United Kingdom catch

    Retitling however I'm not sure this is the right place to do this.

    Does the Url class not handle this already for example using ::fromUri() and then ::toString()?

Production build 0.71.5 2024