From 659ba57d1f7707bc8175bdfe199a09a7f34eba9f Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Mon, 9 Oct 2023 18:45:05 +0200 Subject: [PATCH] Fix media type check in the onSelectMedia hook --- packages/block-library/src/cover/edit/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/cover/edit/index.js b/packages/block-library/src/cover/edit/index.js index 6fac6e8b4a506..512794ee3f0ec 100644 --- a/packages/block-library/src/cover/edit/index.js +++ b/packages/block-library/src/cover/edit/index.js @@ -166,9 +166,12 @@ function CoverEdit( { const onSelectMedia = async ( newMedia ) => { const mediaAttributes = attributesFromMedia( newMedia ); + const isImage = [ newMedia?.type, newMedia?.media_type ].includes( + IMAGE_BACKGROUND_TYPE + ); const averageBackgroundColor = await getMediaColor( - newMedia?.type === IMAGE_BACKGROUND_TYPE ? newMedia?.url : undefined + isImage ? newMedia?.url : undefined ); let newOverlayColor = overlayColor.color;