From 02ccaeed2c9d119e88b9b2ecb26eb6021b2d3ded Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 15 Jan 2018 22:16:33 +0000 Subject: [PATCH] Media: Add `flac` to the list of allowed file types. Props blobfolio. Fixes #42225. git-svn-id: https://develop.svn.wordpress.org/trunk@42451 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 3 ++- src/wp-includes/media.php | 4 ++-- tests/phpunit/tests/functions.php | 10 ++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 320d76918e..7d41b37aef 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -2559,6 +2559,7 @@ function wp_get_mime_types() { 'ra|ram' => 'audio/x-realaudio', 'wav' => 'audio/wav', 'ogg|oga' => 'audio/ogg', + 'flac' => 'audio/flac', 'mid|midi' => 'audio/midi', 'wma' => 'audio/x-ms-wma', 'wax' => 'audio/x-ms-wax', @@ -2646,7 +2647,7 @@ function wp_get_ext_types() { return apply_filters( 'ext2type', array( 'image' => array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ), - 'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ), + 'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'flac', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ), 'video' => array( '3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ), 'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd', 'xcf' ), 'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb' ), diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 393c889ad0..1e6a4e5f58 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -2209,9 +2209,9 @@ function wp_get_audio_extensions() { * @since 3.6.0 * * @param array $extensions An array of support audio formats. Defaults are - * 'mp3', 'ogg', 'm4a', 'wav'. + * 'mp3', 'ogg', 'flac', 'm4a', 'wav'. */ - return apply_filters( 'wp_audio_extensions', array( 'mp3', 'ogg', 'm4a', 'wav' ) ); + return apply_filters( 'wp_audio_extensions', array( 'mp3', 'ogg', 'flac', 'm4a', 'wav' ) ); } /** diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index 52c606537d..d9e3d5fbb8 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -1291,6 +1291,16 @@ class Tests_Functions extends WP_UnitTestCase { 'proper_filename' => false, ), ), + // FLAC file. + array( + DIR_TESTDATA . '/uploads/small-audio.flac', + 'small-audio.flac', + array( + 'ext' => 'flac', + 'type' => 'audio/flac', + 'proper_filename' => false, + ), + ), ) ); }