From 6f47a2c453e5e272c3f33cc5438c51e20a95d7f2 Mon Sep 17 00:00:00 2001 From: ramonopoly Date: Tue, 12 Nov 2024 00:51:17 +0000 Subject: [PATCH] Mime Types: support uploading wav files in Firefox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When uploading `wav` files in the editor, Chrome and other browsers identify the mime type of the file as `audio/wav`. Firefox, however, identifies the mime type as `audio/x-wav`. This commit updates the `'wav'` mime type key in `wp_get_mime_types()` to support `x-wav` so that uploading wav files work in Firefox. Previously, the editor reported an unsupported mime type error. Props imranh920, ramonopoly. Fixes #61948. git-svn-id: https://develop.svn.wordpress.org/trunk@59389 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index ef2ce9d9c3bcf..d9303083bfaa9 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -3417,6 +3417,7 @@ function wp_get_image_mime( $file ) { * @since 4.2.0 Support was added for GIMP (.xcf) files. * @since 4.9.2 Support was added for Flac (.flac) files. * @since 4.9.6 Support was added for AAC (.aac) files. + * @since 6.8.0 Support was added for `audio/x-wav`. * * @return string[] Array of mime types keyed by the file extension regex corresponding to those types. */ @@ -3481,7 +3482,7 @@ function wp_get_mime_types() { 'mp3|m4a|m4b' => 'audio/mpeg', 'aac' => 'audio/aac', 'ra|ram' => 'audio/x-realaudio', - 'wav' => 'audio/wav', + 'wav|x-wav' => 'audio/wav', 'ogg|oga' => 'audio/ogg', 'flac' => 'audio/flac', 'mid|midi' => 'audio/midi',