Provide fallbacks for files without extensions

Created on 1 December 2023, about 1 year ago
Updated 6 February 2024, 11 months ago

Problem/Motivation

We're dealing with a custom stream wrapper that provides externally sourced files which are stored without a file extension. Upon trying to use Stage File Proxy on this site, the following error message is emitted:

Warning: Undefined array key "extension" in Drupal\stage_file_proxy\EventSubscriber\StageFileProxySubscriber->checkFileOrigin() (line 127 of modules/contrib/stage_file_proxy/src/EventSubscriber/StageFileProxySubscriber.php).

This warning could be alleviated with a small check to default the extension to an empty string, probably without affecting the rest of the module's existing behaviour.

Steps to reproduce

  1. Set up site in the way described
  2. Enable Stage File Proxy
  3. Navigate to a page which shows some of these images

Proposed resolution

$extension = pathinfo($request_path)['extension'] ?? '';

Remaining tasks

Implement change and test.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia geoffreyr

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