Skip to content

Commit 20cc872

Browse files
committed
fix(frontend): parse navigation full url or query string - fixes issue with Tiki integration where links are full urls
1 parent bd7590e commit 20cc872

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

modules/core/navigation/utils.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,25 @@ function hideRoutingToast() {
1010

1111
// Undefined is used as the default value instead of null to comply with the route handlers, which also use undefined as the default value.
1212
function getListPathParam() {
13-
return new URLSearchParams(window.location.next || window.location.search).get('list_path') ?? undefined;
13+
return getParam('list_path');
1414
}
1515

1616
function getMessageUidParam() {
17-
return new URLSearchParams(window.location.next || window.location.search).get('uid') ?? undefined;
17+
return getParam('uid');
1818
}
1919

2020
function getPageNameParam() {
21-
return new URLSearchParams(window.location.next || window.location.search).get('page') ?? undefined;
21+
return getParam('page');
2222
}
2323

2424
function getParam(param) {
25-
return new URLSearchParams(window.location.next || window.location.search).get(param) ?? undefined;
25+
let urlOrFragment = window.location.next || window.location.search;
26+
let sp = null;
27+
if (urlOrFragment.match(/^https?:\/\//)) {
28+
let url = new URL(urlOrFragment);
29+
sp = url.searchParams;
30+
} else {
31+
sp = new URLSearchParams(urlOrFragment);
32+
}
33+
return sp.get(param) ?? undefined;
2634
}

0 commit comments

Comments
 (0)