Make WordPress Core

Changeset 56497


Ignore:
Timestamp:
08/30/2023 10:30:06 PM (14 months ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r56494 r56497  
    31503150        $real_mime = finfo_file( $finfo, $file );
    31513151        finfo_close( $finfo );
     3152
     3153        // finfo_file() returns redudant mime type for Google docs, see #57898.
     3154        if ( 'application/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.openxmlformats-officedocument.wordprocessingml.document' === $real_mime ) {
     3155            $real_mime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
     3156        }
    31523157
    31533158        // fileinfo often misidentifies obscure files as one of these types.
Note: See TracChangeset for help on using the changeset viewer.