Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
17 Mar 2026 at 10:54 UTC
Updated:
7 Apr 2026 at 11:40 UTC
Jump to comment: Most recent
Both the MIME Type Guesser service and the single implementation in core are marked as lazy:
file.mime_type.guesser:
class: Drupal\Core\File\MimeType\MimeTypeGuesser
arguments: ['@stream_wrapper_manager']
tags:
- { name: service_collector, tag: mime_type_guesser, call: addMimeTypeGuesser }
lazy: true
file.mime_type.guesser.extension:
class: Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser
arguments: ['@Drupal\Core\File\MimeType\MimeTypeMapInterface']
tags:
- { name: mime_type_guesser }
lazy: true
Neither of these services are expensive to instantiate; the stream wrapper manager will be initialised anyway, and injecting the mime_type_guesser services via a tagger iterator will mean that the individual guessers will only be instantiated when needed (and if a guesser returns early, the later ones will not be needed at all).
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
longwaveComment #5
smustgrave commentedDo these need to be deprecated?
Comment #6
longwaveI don't think anyone would be replacing these services directly, they would just add their own guesser, which works the same way as before.
Comment #7
smustgrave commentedFigured I’d ask. Okay to mark for you
Comment #11
catchCommitted/pushed to main and cherry-picked to 11.x, thanks!