- Issue created by @mogtofu33
- 🇳🇿New Zealand quietone
Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies → .
- 🇫🇷France goz
In \Drupal\Core\Theme\Icon\IconFinder::processFoundFiles()
'source' => $this->fileUrlGenerator->generateString(str_replace($this->appRoot, '', $file_absolute_path)),
does not take care of base_path
Here is a piece of code to check logic.
<?php // Hardcode base path, i want Drupal root with subfolder, so http://domain.tld/dir is my drupal root base path. $GLOBALS['base_path'] = '/dir/'; // Check current code, $this->appRoot does not end by /. $appRoot = '/var/www/html'; echo(\Drupal::service('file_url_generator')->generateString(str_replace($appRoot, '', '/var/www/html/core/modules/system/tests/modules/icon_test/icons'))); // Result is : /core/modules/system/tests/modules/icon_test/icons echo ("\n"); // Add / to the end of appRoot. echo(\Drupal::service('file_url_generator')->generateString(str_replace("{$appRoot}/", '', '/var/www/html/core/modules/system/tests/modules/icon_test/icons'))); // Result is : /dir/core/modules/system/tests/modules/icon_test/icons
We could check first $this->appRoot does not already end by / before adding it.
- Merge request !11155Issue #3504272 by mogtofu33, goz: IconFinder does not generate proper url with base_path() → (Open) created by mogtofu33