Ticket #12518 (new defect (bug))

Opened 2 years ago

Last modified 2 years ago

XML-RPC newMediaObject should try to work out mime-type if not supplied

Reported by: jonquark Owned by: josephscott
Priority: normal Milestone: Future Release
Component: XML-RPC Version:
Severity: normal Keywords: has-patch
Cc: joseph@…, jonquark

Description

At least one XML-RPC client (MaStory on Maemo) does not set the type parameter on uploaded objects. This means we don't create appropriate thumbnails correctly.

Given some clients are on fairly low-power, simple devices, it's probably worth Wordpress attempting to determine the mime-type, especially as functions calls we /already/ make on attachments will give us that information already for the common-case of image uploads.

Attachments

mimetype.patch Download (630 bytes) - added by jonquark 2 years ago.
If not supplied, determine mime-type for uploaded images
mimetype2.patch Download (866 bytes) - added by jonquark 2 years ago.
Alternative patch..now works with non-image mimetypes

Change History

If not supplied, determine mime-type for uploaded images

  • Owner set to josephscott
  • Component changed from General to XML-RPC
  • Milestone changed from Unassigned to Future Release
  • Cc joseph@… added

I'd suggest running this through get_allowed_mime_types() before assuming that the upload is an image.

Alternative patch..now works with non-image mimetypes

Hi Joseph,

When I came to address your comment, I realised that there is a wp_check_filetype() that works with a broader range of mime types.

I've attached a version of the patch that uses it (and also stops passing type to wp_upload_bits as that is deprecated in favour of a call to wp_check_filetype()).

Does that seem reasonable?

  • Cc jonquark added
Note: See TracTickets for help on using tickets.