Submitting a process plugin to wrap Drupal's file.mime_type.guesser service and turn filenames into mimetypes.
I've seen #2877455: Processor to generate file extension of a remote URL and don't believe this functionality exists elsewhere. This will need tests added, but I'm getting an early version up here as a patch for community feedback.
Plugin is almost simple enough that it might be done using callback but I don't think that's quite possible?
We're using this in Islandora migrations to identify file mimetypes as part of an import process, then derive Islandora models, media type etc from the mimetype. (Will link examples later, this is step 1.)
Comments
Comment #2
xurizaemonComment #3
xurizaemonComment #4
xurizaemonComment #5
yogeshmpawarAdding this issue to Needs Review queue.
Comment #6
yogeshmpawarComment #7
srjoshElegant and much needed. Looks good to me!
Comment #8
xurizaemonThanks! If this needs tests added, I'm happy to commit to that (or for someone else to contribute them).
If OTOH you think it can land as-is, I'm OK with that :)
Comment #9
heddnI think this can be just the callback process plugin, no? I guess not because there's no static method. A simple unit test would be good.
Comment #10
xurizaemonIt *almost* could be the callback process plug-in! But I don't think it can be.
Should be able to add tests this week, thanks!
Comment #11
matroskeenThere is a feature request to add a general plugin called "service". Please take a look into #3218356: Process plugin: service.
The issue summary contains the example of using the
file.mime_type.guesserrequested here 😃I think we can close this one as a duplicate.
Comment #12
xurizaemonNice work! That'll teach me to not get around to adding tests :) Subscribing, looks great.