Default public scheme is wrongly not considered as a local filesystem

Created on 26 June 2023, over 1 year ago

Problem/Motivation

When retrieving image derivatives, the buildDerivativeLink() method is supposed to calculate the width and height of the image as well as generating it if the file system used is the local one.

Full code :

if ($this->streamWrapperManager->getViaScheme(StreamWrapperManager::getScheme($uri))->getType() & ~StreamWrapperInterface::LOCAL) {
  return $info;
}

This does not work for the default local public scheme public:// since this one is considered as LOCAL_NORMAL instead of NORMAL.

Steps to reproduce

  1. Set up Drupal 10 with the default public file system (sites/default/files / public://)
  2. Set up the module as explained in the documentation
  3. Try to retrieve image derivatives through JSON API
  4. See that the image is not generated and the width / height are not provided

Proposed resolution

Replace by NORMAL by LOCAL_NORMAL in accordance with the core documentation :

/**
 * Visible, readable and writable using local files.
 */
const LOCAL_NORMAL = 0x001D;
๐Ÿ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

๐Ÿ‡ซ๐Ÿ‡ทFrance Nixou Toulon

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