Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 6 years ago

#45707 closed task (blessed) (fixed)

Add parameter $real_mime to wp_check_filetype_and_ext

Reported by: Tkama Owned by: pento
Priority: normal Milestone: 5.1
Component: Upload Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

In some cases, I need the parameter $real_mime in hook wp_check_filetype_and_ext. I don't see any reasons to not pass it there.

<?php
return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes, $real_mime );

Attachments (1)

45707.diff (1.8 KB ) - added by desrosj 8 years ago.

Download all attachments as: .zip

Change History (16)

#1 @SergeyBiryukov
8 years ago

  • Component GeneralUpload
  • Milestone Awaiting Review5.1

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


8 years ago

#3 @desrosj
8 years ago

  • Keywords needs-patch added
  • Version 5.0.1

@desrosj
8 years ago

#4 @desrosj
8 years ago

  • Keywords has-patch added; needs-patch removed

#5 @joemcgill
8 years ago

  • Owner set to joemcgill
  • Status newaccepted

Thanks @Tkama,

I think something like this could be really helpful for people trying to get around issues like #45615. I'm expecting to make some changes to the way this works in 5.1 so let's include this ticket in the process.

Cheers!

#6 @joemcgill
8 years ago

  • Type enhancementtask (blessed)

If #40175 doesn't land in 5.1 (and maybe even if it does) we should do this to help folks experiencing issues like #45615 more easily filter wp_check_filetype_and_ext(). Going to mark this as task/blessed and revisit depending on #40175.

#7 @pento
8 years ago

Aye, this seems like a reasonable alternative to landing #40175 in 5.1.

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


8 years ago

#9 @joemcgill
8 years ago

  • Keywords commit added

Let's go ahead and do this for 5.1.

#10 @pento
8 years ago

  • Owner changed from joemcgill to pento

#11 @pento
8 years ago

  • Resolutionfixed
  • Status acceptedclosed

In 44677:

Media: Add a $real_mime parameter to the wp_check_filetype_and_ext filter.

This allows more accurate filtering of the filename and extension given to uploaded files.

Props desrosj, Tkama.
Fixes #45707.

#12 @pento
8 years ago

  • Keywords needs-dev-note added

@joemcgill, @desrosj: As this is the workaround for the #40175, it'd be good to have a dev note explaining how to use it.

#13 @joemcgill
8 years ago

@pento, @desrosj – I'll write a dev note.

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


8 years ago

#15 @desrosj
6 years ago

  • Keywords commit needs-dev-note removed

As far as I can tell, this never received a developer note. Removing the needs-dev-note keyword.

Note: See TracTickets for help on using tickets.