Sparkpost MimeTypeGuesser::guess() is removed, D10 compatibility

Created on 3 June 2024, 7 months ago

Problem/Motivation

I have updated Drupal core version from Drupal 9.5.11 to Drupal 10.2.6

My configurations:
- Drupal core 10.2.6
- 8.1.28
- Sparkpost 3.0.0-alpha1

There is a non-supported code being used in modules/contrib/sparkpost/src/Plugin/Mail/SparkpostMail.php line no 171
https://www.drupal.org/node/3126004

\Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface is deprecated in drupal:9.1.0 and will be removed in drupal:10.0.0, implement \Symfony\Component\Mime\MimeTypeGuesserInterface instead

This prevent sending a test email from admin UI. It works when I replace the lines with guessMimeType().

Error: Call to undefined method Drupal\\Core\\ProxyClass\\File\\MimeType\\MimeTypeGuesser::guess() in Drupal\\sparkpost\\Plugin\\Mail\\SparkpostMail->getAttachmentStruct() (line 171 of /var/www/drupal-cms/web/modules/contrib/sparkpost/src/Plugin/Mail/SparkpostMail.php

Steps to reproduce

Try sending a test email from here: [your_app]/admin/config/services/sparkpost/test

Proposed resolution

use guessMimeType() instead of guess(), as guess() has been removed from Drupal 10.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

🇮🇳India mahendrakalal

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024