Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#45707 closed task (blessed) (fixed)

Add parameter $real_mime to wp_check_filetype_and_ext

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


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.

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 5 years ago.

Download all attachments as: .zip

Change History (16)

#1 @SergeyBiryukov
5 years ago

  • Component changed from General to Upload
  • Milestone changed from Awaiting Review to 5.1

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

5 years ago

#3 @desrosj
5 years ago

  • Keywords needs-patch added
  • Version 5.0.1 deleted

5 years ago

#4 @desrosj
5 years ago

  • Keywords has-patch added; needs-patch removed

#5 @joemcgill
5 years ago

  • Owner set to joemcgill
  • Status changed from new to accepted

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.


#6 @joemcgill
5 years ago

  • Type changed from enhancement to task (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
5 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.

5 years ago

#9 @joemcgill
5 years ago

  • Keywords commit added

Let's go ahead and do this for 5.1.

#10 @pento
5 years ago

  • Owner changed from joemcgill to pento

#11 @pento
5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

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
5 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
5 years ago

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

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

5 years ago

#15 @desrosj
4 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.