Hotlink and use_imagecache_root both on will bypass use_imagecache_root

Created on 17 June 2025, 4 months ago

When i noticed images with a new image style where not loaded in, i started to debug the code in "StageFileProxySubscriber.php" There i noticed, when using both hotlink and use_imagecache_root, use_imagecache_root set path is not used, but instead the relative path is still being used.

        if ($config->get('use_imagecache_root') && $unconverted_path === $relative_path) {
          // Config says: Fetch the original.
          $fetch_path = StreamWrapperManager::getTarget($original_path);
        }
     
      ...

      if ($config->get('hotlink')) {
        $relative_path = UrlHelper::encodePath($relative_path);
        $location = Url::fromUri("$server/$remote_file_dir/$relative_path", [
          'query' => $query_parameters,
          'absolute' => TRUE,
        ])->toString();

Proposed solution to remove $fetch_path variable and use $relative_path instead.

πŸ› Bug report
Status

Active

Version

3.1

Component

Code

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