From 2e911f4f161ba2f080d889e7333211bc93e011f5 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Tue, 9 Nov 2021 14:59:44 +0000 Subject: [PATCH] Media: Add "webp" extension to wp.media.controller.Library `isImageAttachment`. Add "webp" extension to a media extension check, fixing an issue where the last used media link type was not used for WebP images. Props almendron, desrosj, kallookoo. Fixes #53917. git-svn-id: https://develop.svn.wordpress.org/trunk@52073 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/media/controllers/library.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/media/controllers/library.js b/src/js/media/controllers/library.js index ace0028644..2acc89a586 100644 --- a/src/js/media/controllers/library.js +++ b/src/js/media/controllers/library.js @@ -196,7 +196,7 @@ Library = wp.media.controller.State.extend(/** @lends wp.media.controller.Librar isImageAttachment: function( attachment ) { // If uploading, we know the filename but not the mime type. if ( attachment.get('uploading') ) { - return /\.(jpe?g|png|gif)$/i.test( attachment.get('filename') ); + return /\.(jpe?g|png|gif|webp)$/i.test( attachment.get('filename') ); } return attachment.get('type') === 'image';