Incompatibility with S3fs: MediaContextualCropService constructor expects FileSystem, receives S3fsFileSystem

Created on 18 January 2025, 1 day ago

Problem/Motivation

The MediaContextualCropService constructor expects an argument of type FileSystem, but when using the S3fs module, the injected service is S3fsFileSystem, causing a TypeError.

Steps to reproduce

TypeError: Drupal\media_contextual_crop\MediaContextualCropService::__construct(): Argument #2 ($file_system) must be of type Drupal\Core\File\FileSystem, Drupal\s3fs\S3fsFileSystemD103 given, called in /web/core/lib/Drupal/Component/DependencyInjection/Container.php
Environment:
Drupal version: 11.x
PHP version: 8.3
Media Contextual Crop version: 2.1
S3fs version: 8.x-3.7

Proposed resolution

Proposed Fix:
The MediaContextualCropService should use FileSystemInterface instead of FileSystem in its constructor to ensure compatibility with custom file systems such as S3fs.

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇬🇧United Kingdom harpade

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