Problem

DomainSourcePathProcessor::processOutbound() uses LanguageInterface::TYPE_CONTENT to determine the langcode for entity translation lookup. It should use TYPE_URL instead, so that the entity translation matches the language conveyed by the URL.

Core's AliasManager::getAliasByPath() explicitly defaults to TYPE_URL with this rationale:

If no language is explicitly specified we default to the current URL language. If we used a language different from the one conveyed by the requested URL, we might end up being unable to check if there is a path alias matching the URL path.

When the content language and URL language diverge (which can happen depending on language negotiation settings), using TYPE_CONTENT can produce incorrect cross-domain rewrites.

Proposed fix

  • Change TYPE_CONTENT to TYPE_URL for the langcode fallback
  • Change the cache context from languages:language_content to languages:language_url

Issue fork domain-3575977

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Project: Domain Path » Domain

mably changed the visibility of the branch 3575977-use-typeurl-instead to hidden.

mably’s picture

Issue summary: View changes

mably’s picture

Status: Active » Needs review
mably’s picture

Status: Needs review » Closed (won't fix)

Not sure this is any better that what we currently have.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.