- Issue created by @cmlara
- Merge request !80Issue #3529457 by cmlara: Copy core 11.1.x ExtensionMimeTypeGuesser to s3fs β (Merged) created by cmlara
- π¨π¦Canada b_sharpe
Everything looks fine, confirmed I don't get the circular referencing as well. Small comment about calling out the change between core and override.
- πΊπΈUnited States cmlara
Added notes to the file comment referring to core and this issue.
As a deeper summary:
The history on s3fs having initialized its own copy of the MimeTypeExtensionGuesser can be traced back to #3259065: Circular reference detected for service "s3fsfileservice" with mime_type guesser β . We were avoiding a circular reference after having added
s3fsfileservice
which decorates the corefile_system
service.Some (many?) MimeType guessers make use of the
FileSystemInterface::basename()
method. In the past this has been via a global container call\Drupal::service('file_system')
in-line, however as part of proper service injection these calls are slowly being removed.The
s3fsfileservice
is somewhat unique with the fact it needs to know the mime type of a file as part of the Move/Copy operations to correctly set the headers from the S3 Bucket.FileSystemInterface::basename()
is unfortunately just in a poor location for this scenario.To solve this our copy will use the native
basename()
function.FileSystem::basename()
appears functionally identical to the PHPbasename()
. It would make no sense for a streamWrapper to be implemented in a manner where basename() does not follow the native format as such streamWrappers would be incompatible with normal PHP scripts. The entire purpose of streamWrappers is to provide program agnostic storage.Ideally as a followup we would encourage core to deprecate/remove
FileSystemInterface::basename()
to allow us to return to operating with the Core instance of mime type guessing services. - πΊπΈUnited States cmlara
Digging a bit more into the core side history of this, there there is/was apparently a locales issues.
https://bugs.php.net/bug.php?id=37738
It does appear this issue is no longer present in modern PHP versions, although it does exist for the entire PHP7 line.
https://3v4l.org/XcflK.Perhaps we will want to copy the
FileSystem::basename()
as PHP7.1 is listed for S3FS supported environments.
-
cmlara β
committed 08dcb3f4 on 8.x-3.x
Issue #3529457 by cmlara, b_sharpe: Copy core 11.1.x...
-
cmlara β
committed 08dcb3f4 on 8.x-3.x
Automatically closed - issue fixed for 2 weeks with no activity.