From 80d49178301c1849936505f8c095ad24e1af8dae Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Thu, 9 Feb 2023 09:55:14 +0200 Subject: [PATCH] [Block Library - Cover]: Ensure `url` is not malformed due to sanitization through `wp_kses` --- 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 de491582f724e..a74ebe8fe18eb 100644 --- a/packages/block-library/src/cover/edit/index.js +++ b/packages/block-library/src/cover/edit/index.js @@ -116,7 +116,10 @@ function CoverEdit( { // we define the url and background type // depending on the value of the useFeaturedImage flag // to preview in edit the dynamic featured image - const url = useFeaturedImage ? mediaUrl : attributes.url; + const url = useFeaturedImage + ? mediaUrl + : // Ensure the url is not malformed due to sanitization through `wp_kses`. + attributes.url?.replaceAll( '&', '&' ); const backgroundType = useFeaturedImage ? IMAGE_BACKGROUND_TYPE : attributes.backgroundType;