Skip to content
Snippets Groups Projects
Unverified Commit c7976414 authored by Aleksandr Lesnenko's avatar Aleksandr Lesnenko Committed by GitHub
Browse files

open absolute urls not relatively to a metabase instance (#27097)

parent f6cd7cc6
No related merge requests found
......@@ -247,6 +247,8 @@ export function constrainToScreen(element, direction, padding) {
return false;
}
const isAbsoluteUrl = url => url.startsWith("/");
function getWithSiteUrl(url) {
const siteUrl = MetabaseSettings.get("site-url");
return url.startsWith("/") ? siteUrl + url : url;
......@@ -302,12 +304,17 @@ export function open(
...options
} = {},
) {
const isOriginalUrlAbsolute = isAbsoluteUrl(url);
url = ignoreSiteUrl ? url : getWithSiteUrl(url);
if (shouldOpenInBlankWindow(url, options)) {
openInBlankWindow(url);
} else if (isSameOrigin(url)) {
openInSameOrigin(url, getLocation(url));
if (isOriginalUrlAbsolute) {
clickLink(url, false);
} else {
openInSameOrigin(url, getLocation(url));
}
} else {
openInSameWindow(url);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment