Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295826

Fix base prefix when generating URLs if index.php is in the path

$
0
0

Problem/Motivation

Follow-up to #1088112: Introduce a token to get site's base URL

Steps to reproduce:

  1. Go to your installed drupal directory and append index.php (e.g http://drupal.test/index.php)
  2. Build a URL with base prefix: Url::fromUri('base:sites/default/files/og_image.jpg')
  3. Assert the URL to the image asset is broken as the path is /index.php/sites/default/files/og_image.jpg

Proposed resolution

When building a URL with base prefix use $request->getBasePath() instead of $request->getBaseUrl() which results in omitting index.php in case it is present.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 295826

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>