Make WordPress Core

Opened 3 months ago

Closed 6 weeks ago

#59277 closed defect (bug) (duplicate)

Bug: wp_check_filetype_and_ext returns type and ext as false for font files

Reported by: madhudollu's profile madhudollu Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.3
Component: Upload Keywords:
Focuses: Cc:

Description

the function wp_check_filetype_and_ext returns both type and ext as false for font files (.ttf, .woff, .woff2 etc..)

This is because the $real_mime for the font files is application/octet-stream and the following condition has no check for font mimes. (font/ttf, font/woff)

// file: src/wp-includes/functions.php
// line: 3184

if ( in_array( $real_mime, $nonspecific_types, true ) ) {
  if ( ! in_array( substr( $type, 0, strcspn( $type, '/' ) ), array( 'application', 'video', 'audio' ), true ) ) {
    $type = false;
    $ext  = false;
  }
}

Change History (2)

#1 @sabernhardt
6 weeks ago

  • Component changed from General to Upload

#2 @hellofromTonya
6 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version changed from trunk to 4.7.3

Hello @madhudollu,

Welcome back to WordPress Core's Trac :)

#40175 is tracking upload validation and mime handling. Let's continue the discussion there.

Note: See TracTickets for help on using tickets.