Use URL.origin instead of URL.pathname
If the app gets initialized before being redirected from empty URL (e.g. https://gerrit-review.googlesource.com/), the trailing slash is returned as pathname resutlting in _getUrl() returning 'https:' thus generating valid URL for loading plugins. This masked the actual problem by generating valid plugin URLs while waiting for loading from the invalid ones. Use URL.origin() instead for building full plugin URLs. Bug: Issue 8941 Change-Id: I65bad6c4b1c418c2588e131073b2d4ba8b80117c
This commit is contained in:
@@ -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;
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
@@ -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(() => {
|
||||
|
Reference in New Issue
Block a user