diff --git a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js index a7cfca365c..c5bf21a530 100644 --- a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js +++ b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js @@ -102,8 +102,7 @@ if (!pathOrUrl.startsWith('/')) { pathOrUrl = '/' + pathOrUrl; } - const {href, pathname} = window.location; - return href.split(pathname)[0] + this.getBaseUrl() + pathOrUrl; + return window.location.origin + this.getBaseUrl() + pathOrUrl; }, }); })(); diff --git a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.html b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.html index daa86fad73..0880d73549 100644 --- a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.html +++ b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.html @@ -43,7 +43,7 @@ limitations under the License. sandbox = sinon.sandbox.create(); sandbox.stub(document.body, 'appendChild'); sandbox.stub(element, 'importHref'); - url = window.location.href.split(window.location.pathname)[0]; + url = window.location.origin; }); teardown(() => {