- Issue created by @czigor
- Status changed to Needs review
about 1 year ago 2:17pm 29 September 2023 - last update
about 1 year ago 19 pass - Status changed to RTBC
about 1 year ago 12:01pm 20 October 2023 - 🇳🇱Netherlands timohuisman Leiden, Netherlands
Can confirm that this resolved the issue on Drupal 10.1.5.
- 🇷🇸Serbia vaish
Patch #2 fixes the issue for me. However, I don't think if condition in the patch is necessary. Service
file.mime_type.guesser
is provided by the classDrupal\Core\File\MimeType\MimeTypeGuesser
which implements interfaceSymfony\Component\Mime\MimeTypeGuesserInterface
. I don't see an opportunity to ever get anything else.This should be sufficient:
- $image->filemime = \Drupal::service('file.mime_type.guesser')->guess($image_path); + $image->filemime = \Drupal::service('file.mime_type.guesser')->guessMimeType($image_path);
- 🇭🇺Hungary czigor
@vaish In Drupal core < 10 this was not the case. The if condition is needed to not break backward compatibility.
- 🇷🇸Serbia vaish
@czigor You are right, I did overlook backward compatibility. However, Drupal 9 should not be a problem, unless you are on a very old version. Method
::guessMimeType()
is available since Drupal 9.1 (but not in Drupal 9.0). So problem exists with Drupal 9.0 and 8.x and I did overlook that this module still claims the compatibility with Drupal 8.9.Drupal 9: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21File%21Mi...