LanguageNegotiationUrl unnecessarily adds domain to outbound URL's

Created on 29 February 2024, about 1 year ago

Problem/Motivation

Core does not always check if external URL's are local (using UrlHelper::externalIsLocal) which has varied consequences. We can avoid adding the base_path to outbound URL's by checking if the language negotiation path is the same as the current path and avoid some problems.

See 🐛 Cannot delete file when using language negotiation domains Active for full context.

Steps to reproduce

  1. Setup two domains (.ddev/config.yaml additional_hostnames, I used "local" and "es.local").
  2. Install Drupal, enable media and language modules.
  3. Add a language for the second domain on admin/config/regional/language (I used Spanish). Configure detection on admin/config/regional/language/detection, edit "URL", select "Domain", and set the two domain URL's (I used local.ddev.site and es.local.ddev.site)
  4. Add a media document from admin/content/media
  5. Visit admin/content/files and hover over the "Delete" link. Notice that it uses the full URL.

Proposed resolution

Add an additional check in LanguageNegotiationUrl::processOutbound() that returns early if the base_url's match.

🐛 Bug report
Status

Active

Version

10.2

Component
Language system 

Last updated 2 days ago

  • Maintained by
  • 🇩🇪Germany @sun
Created by

🇺🇸United States douggreen Winchester, VA

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