From 72596bd853544847ff038944d0a09b75ee1416e8 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 26 Nov 2024 09:08:22 +0100 Subject: [PATCH] fix: should check specifically for if pathname is undefined or empty --- .../packages/core/utils/path/has-own-opener.function.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/has-own-opener.function.ts b/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/has-own-opener.function.ts index 3fda364240..5d4ee2ce53 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/has-own-opener.function.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/has-own-opener.function.ts @@ -22,11 +22,12 @@ export function hasOwnOpener(pathname?: string, windowLike: Window = globalThis. return false; } - if (pathname && openerLocation.pathname.startsWith(pathname)) { - return true; + // If there is a pathname, check if the opener has the same pathname + if (typeof pathname !== 'undefined' && !openerLocation.pathname.startsWith(pathname)) { + return false; } - return false; + return true; } catch { // If there is a security error, it means that the opener is from a different origin, so we let it fall through return false;