Make WordPress Core

Opened 22 months ago

Closed 20 months ago

Last modified 8 months 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: has-patch
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 (8)

#1 @sabernhardt
20 months ago

  • Component changed from General to Upload

#2 @hellofromTonya
20 months 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.

This ticket was mentioned in PR #7626 on WordPress/wordpress-develop by @desrosj.


8 months ago
#3

  • Keywords has-patch added

After the changes in Core-59277, Compose files are manually passed to the Docker commands. If a docker-compose.override.yml file is present, it won't be utilized. This attempts to detect that and include the file in the list that is passed.

Trac ticket:

@desrosj commented on PR #7626:


8 months ago
#4

@xknown env variable for which part? Do you mean for the additional value of volumes in the old-php-mysql-84.override.yml file?

I just did some testing, and it seems that Docker fails when an empty value for a volume is supplied. The new override file is needed _in addition_ to the other two supplied in the default docker-compose.yml file, not instead of. So I'm not sure how to get it working with an environment variable with the limited variable substitution available.

@xknown commented on PR #7626:


8 months ago
#5

@xknown env variable for which part? Do you mean for the additional value of volumes in the old-php-mysql-84.override.yml file?

I just did some testing, and it seems that Docker fails when an empty value for a volume is supplied. The new override file is needed _in addition_ to the other two supplied in the default docker-compose.yml file, not instead of. So I'm not sure how to get it working with an environment variable with the limited variable substitution available.

No, I was just wondering if it'd make sense to add something like the snippet below to utils.js

if ( typeof process.env.DOCKER_COMPOSE_CONFIG_OVERRIDE !== 'undefined' ) {
  composeFiles = composeFiles + process.env.DOCKER_COMPOSE_CONFIG_OVERRIDE
}

@desrosj commented on PR #7626:


8 months ago
#6

No, I was just wondering if it'd make sense to add something like the snippet below to utils.js

if ( typeof process.env.DOCKER_COMPOSE_CONFIG_OVERRIDE !== 'undefined' ) {
  composeFiles = composeFiles + process.env.DOCKER_COMPOSE_CONFIG_OVERRIDE
}

Ah, I see! I think if we find out that people are supplying custom override files we could consider that. But I don't know that is likely to be the case.

We also currently recommend using that file name in the README file for working with MySQL < 8.0 on Apple silicon chips. An env variable would also require an additional step (create the file, update the variable). So I think I prefer trying this approach first.

@desrosj commented on PR #7626:


8 months ago
#7

No, I was just wondering if it'd make sense to add something like the snippet below to utils.js

if ( typeof process.env.DOCKER_COMPOSE_CONFIG_OVERRIDE !== 'undefined' ) {
  composeFiles = composeFiles + process.env.DOCKER_COMPOSE_CONFIG_OVERRIDE
}

Ah, I see! I think if we find out that people are supplying custom override files we could consider that. But I don't know that is likely to be the case.

We also currently recommend using that file name in the README file for working with MySQL < 8.0 on Apple silicon chips. An env variable would also require an additional step (create the file, update the variable). So I think I prefer trying this approach first.

Note: See TracTickets for help on using tickets.