Make WordPress Core

Opened 15 years ago

Closed 10 years ago

Last modified 10 years ago

#12518 closed defect (bug) (invalid)

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

Reported by: jonquark's profile jonquark Owned by: josephscott's profile josephscott
Milestone: Priority: normal
Severity: normal Version:
Component: XML-RPC Keywords:
Focuses: Cc:

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 (2)

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

Download all attachments as: .zip

Change History (8)

@jonquark
15 years ago

If not supplied, determine mime-type for uploaded images

#1 @jonquark
15 years ago

  • Component changed from General to XML-RPC
  • Milestone changed from Unassigned to Future Release
  • Owner set to josephscott

#2 @josephscott
15 years ago

  • Cc joseph@… added

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

@jonquark
15 years ago

Alternative patch..now works with non-image mimetypes

#3 @jonquark
15 years ago

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?

#4 @jonquark
15 years ago

  • Cc jonquark added

#5 @chriscct7
10 years ago

  • Keywords close needs-refresh added; has-patch removed
  • Resolution set to invalid
  • Status changed from new to closed

The XMLRPC uploader now calls mw_newMediaObject in 4.0 which has the changed type param in the wp_upload_bits call to NULL. wp_upload_bits also now checks the type of file using wp_check_filetype() so we're good to go on that front to. This patch (which would need to be refreshed anyways) is no longer needed.

#6 @DrewAPicture
10 years ago

  • Keywords close needs-refresh removed
  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.