Opened 10 years ago
Last modified 5 years ago
#5444 in_progress defect
Implement 'type_match_handler' hook for all core media types
| Reported by: | ayleph | Owned by: | ayleph |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | programming | Keywords: | processing, sniffing |
| Cc: | Boris Bobrov | Parent Tickets: |
Description
Since the gstreamer-1.0 update, uploaded media are sniffed and very often (always?) produce messages like below, even when the media are successfully processed. Breton says this is not intentional and should be addressed.
No plugins handled extension .jpg
Attachments (1)
Change History (6)
comment:1 by , 10 years ago
comment:2 by , 8 years ago
| Summary: | No plugins handled extension → Implement 'type_match_handler' hook for all core media types |
|---|
I stumbled across this again and it's still an issue. We should implement the type_match_handler hook for other media types as well. I've changed the ticket summary to reflect this.
comment:3 by , 8 years ago
| Owner: | set to |
|---|---|
| Status: | new → in_progress |
comment:4 by , 5 years ago
The "image" media type currently conflates the process of identifying by file extension and checking the file content. Before I'd seen this ticket I wrote a small patch to allow uploading images without file extensions - see attachment. This skips the file extension check entirely and relies on sniff_handler trying to open the image.
The feature here that's most important to me is that we can accept any file, with or without a file extension and generally do the right thing.
by , 5 years ago
| Attachment: | image_sniffing_#5444.patch added |
|---|
Quick hack to allow upload of image files without file extensions. Doesn't fully address this ticket.
comment:5 by , 5 years ago
See also #5318 which is about errors caused when a .gif file is incorrectly named with .jpg extension. We need a robust solution that can take anything people throw at us (assuming we have the tech to transcode it).

This error comes from
mediagoblin/media_types/__init__.pydef type_match_handler(media_file, filename): ... if os.path.basename(filename).find('.') > 0: ... hook_result = hook_handle('type_match_handler', ext[1:]) if hook_result: ... else: _log.info('No plugins handled extension {0}'.format(ext)) else: _log.info('File {0} has no known file extension, let\'s hope ' 'the sniffers get it.'.format(filename)) raise TypeNotFound(_(u'Sorry, I don\'t support that file type :('))Doing a search through code for
type_match_handlershows that only the video mediatype provides this hook, while all of the other media types still use the deprecatedget_media_type_and_managerhook.If
get_media_type_and_manageris really deprecated, then maybe all of the other mediatypes should be updated to supporttype_match_handler. I'm not sure if that's the cause of this issue or if it's a separate issue that also needs to be addressed.