Skip to content

Commit 1b3782f

Browse files
iOvergaardmadsrasmussen
authored andcommitted
fix: should check specifically for if pathname is undefined or empty
1 parent b6551d6 commit 1b3782f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Umbraco.Web.UI.Client/src/packages/core/utils/path/has-own-opener.function.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ export function hasOwnOpener(pathname?: string, windowLike: Window = globalThis.
2222
return false;
2323
}
2424

25-
if (pathname && openerLocation.pathname.startsWith(pathname)) {
26-
return true;
25+
// If there is a pathname, check if the opener has the same pathname
26+
if (typeof pathname !== 'undefined' && !openerLocation.pathname.startsWith(pathname)) {
27+
return false;
2728
}
2829

29-
return false;
30+
return true;
3031
} catch {
3132
// If there is a security error, it means that the opener is from a different origin, so we let it fall through
3233
return false;

0 commit comments

Comments
 (0)