WordPress.org

Make WordPress Core

Changeset 49049


Ignore:
Timestamp:
09/26/2020 01:09:52 AM (10 months ago)
Author:
SergeyBiryukov
Message:

Upload: Add a check in wp_check_filetype_and_ext() to account for CSV files having the application/csv MIME type.

Previously, the PHP Fileinfo extension used to detect CSV files as text/plain.

In PHP 8, this has changed, and CSV files are detected as application/csv.

Follow-up to [44438].

See #50913.

File:
1 edited

Legend:

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

    r49042 r49049  
    29342934                    'text/plain',
    29352935                    'text/csv',
     2936                    'application/csv',
    29362937                    'text/richtext',
    29372938                    'text/tsv',
    29382939                    'text/vtt',
     2940                ),
     2941                true
     2942            )
     2943            ) {
     2944                $type = false;
     2945                $ext  = false;
     2946            }
     2947        } elseif ( 'application/csv' === $real_mime ) {
     2948            // Special casing for CSV files.
     2949            if ( ! in_array(
     2950                $type,
     2951                array(
     2952                    'text/csv',
     2953                    'text/plain',
     2954                    'application/csv',
    29392955                ),
    29402956                true
Note: See TracChangeset for help on using the changeset viewer.