Upload: Add a MIME type exception for `.docx` generated by Google Docs.
This changeset adds an exception to prevent permission issues on `.docx` generated by Google Docs. This is a temporary fix for an upstream bug on the `finfo_file()` PHP function which returns a redundant MIME type for these documents. Props winterstreet, jakariaistauk, mujuonly, mi5t4n, annashopina, audrasjb, azaozz, mikeschroder, oglekler. Fixes #57898. Built from https://develop.svn.wordpress.org/trunk@56497 git-svn-id: http://core.svn.wordpress.org/trunk@56009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6687c0ec8f
commit
f6bd4ab08e
|
@ -3150,6 +3150,11 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||||
$real_mime = finfo_file( $finfo, $file );
|
$real_mime = finfo_file( $finfo, $file );
|
||||||
finfo_close( $finfo );
|
finfo_close( $finfo );
|
||||||
|
|
||||||
|
// finfo_file() returns redudant mime type for Google docs, see #57898.
|
||||||
|
if ( 'application/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.openxmlformats-officedocument.wordprocessingml.document' === $real_mime ) {
|
||||||
|
$real_mime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
||||||
|
}
|
||||||
|
|
||||||
// fileinfo often misidentifies obscure files as one of these types.
|
// fileinfo often misidentifies obscure files as one of these types.
|
||||||
$nonspecific_types = array(
|
$nonspecific_types = array(
|
||||||
'application/octet-stream',
|
'application/octet-stream',
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.4-alpha-56496';
|
$wp_version = '6.4-alpha-56497';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue