From 211117f76e9e87d3cf221ae790ff312c331a3503 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 21 Sep 2026 15:19:11 -0600 Subject: [PATCH 1/3] Clean up loose hostname matches --- .../src/features/wpcom-themes/js/theme-actions.js | 2 +- .../masterbar/src/nudges/additional-css/additional-css.js | 2 +- .../boost/app/modules/optimizations/image-cdn/src/srcset.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-themes/js/theme-actions.js b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-themes/js/theme-actions.js index afe6d41ef7b5..70390fddce2b 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-themes/js/theme-actions.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-themes/js/theme-actions.js @@ -10,7 +10,7 @@ const wpcomThemesRemoveWpcomActions = () => { for ( const node of mutation.addedNodes ) { const themeActions = node.querySelector( '.theme-actions .active-theme' ); for ( const action of themeActions?.children ?? [] ) { - if ( action.getAttribute( 'href' )?.includes( 'https://wordpress.com' ) ) { + if ( action.getAttribute( 'href' )?.startsWith( 'https://wordpress.com/' ) ) { themeActions.removeChild( action ); } } diff --git a/projects/packages/masterbar/src/nudges/additional-css/additional-css.js b/projects/packages/masterbar/src/nudges/additional-css/additional-css.js index 4a8a88bc4438..5ab7667ccc0d 100644 --- a/projects/packages/masterbar/src/nudges/additional-css/additional-css.js +++ b/projects/packages/masterbar/src/nudges/additional-css/additional-css.js @@ -20,7 +20,7 @@ import './additional-css.css'; // Get destination. const destination = this.getAttribute( 'data-navigate-to-page' ); - if ( ! destination ) { + if ( ! destination?.startsWith( '/' ) ) { return; } diff --git a/projects/plugins/boost/app/modules/optimizations/image-cdn/src/srcset.ts b/projects/plugins/boost/app/modules/optimizations/image-cdn/src/srcset.ts index 77e6ca350ad1..f0105ae202df 100644 --- a/projects/plugins/boost/app/modules/optimizations/image-cdn/src/srcset.ts +++ b/projects/plugins/boost/app/modules/optimizations/image-cdn/src/srcset.ts @@ -87,7 +87,7 @@ export function dynamicSrcset( img: HTMLImageElement ) { ! img.getAttribute( 'height' ) || ! img.srcset || ! img.src || - ! img.src.includes( '.wp.com' ) + ! new URL( img.src ).hostname.endsWith( '.wp.com' ) ) { return; } From c6b061756b75da41897b87324130b2de7ad83e2a Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 21 Sep 2026 15:19:47 -0600 Subject: [PATCH 2/3] Add changelogs --- .../changelog/fix-clean_up_loose_hostname_matches | 5 +++++ .../masterbar/changelog/fix-clean_up_loose_hostname_matches | 5 +++++ .../boost/changelog/fix-clean_up_loose_hostname_matches | 5 +++++ 3 files changed, 15 insertions(+) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/fix-clean_up_loose_hostname_matches create mode 100644 projects/packages/masterbar/changelog/fix-clean_up_loose_hostname_matches create mode 100644 projects/plugins/boost/changelog/fix-clean_up_loose_hostname_matches diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-clean_up_loose_hostname_matches b/projects/packages/jetpack-mu-wpcom/changelog/fix-clean_up_loose_hostname_matches new file mode 100644 index 000000000000..838cb4533425 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/fix-clean_up_loose_hostname_matches @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Clean up loose hostname matches. + + diff --git a/projects/packages/masterbar/changelog/fix-clean_up_loose_hostname_matches b/projects/packages/masterbar/changelog/fix-clean_up_loose_hostname_matches new file mode 100644 index 000000000000..838cb4533425 --- /dev/null +++ b/projects/packages/masterbar/changelog/fix-clean_up_loose_hostname_matches @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Clean up loose hostname matches. + + diff --git a/projects/plugins/boost/changelog/fix-clean_up_loose_hostname_matches b/projects/plugins/boost/changelog/fix-clean_up_loose_hostname_matches new file mode 100644 index 000000000000..838cb4533425 --- /dev/null +++ b/projects/plugins/boost/changelog/fix-clean_up_loose_hostname_matches @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Clean up loose hostname matches. + + From 0688eec94aa7167d8642ab3e79320518f8bcc7b1 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 21 Sep 2026 15:36:19 -0600 Subject: [PATCH 3/3] Add try/catch in case the host is invalid --- .../app/modules/optimizations/image-cdn/src/srcset.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/projects/plugins/boost/app/modules/optimizations/image-cdn/src/srcset.ts b/projects/plugins/boost/app/modules/optimizations/image-cdn/src/srcset.ts index f0105ae202df..b77ad648e52c 100644 --- a/projects/plugins/boost/app/modules/optimizations/image-cdn/src/srcset.ts +++ b/projects/plugins/boost/app/modules/optimizations/image-cdn/src/srcset.ts @@ -86,12 +86,19 @@ export function dynamicSrcset( img: HTMLImageElement ) { ! img.getAttribute( 'width' ) || ! img.getAttribute( 'height' ) || ! img.srcset || - ! img.src || - ! new URL( img.src ).hostname.endsWith( '.wp.com' ) + ! img.src ) { return; } + try { + if ( ! new URL( img.src ).hostname.endsWith( '.wp.com' ) ) { + return; + } + } catch { + return; + } + const rect = img.getBoundingClientRect(); const targetSize = calculateTargetSize( rect );