Fix Top Menu Url

This fixes it so that if it provides a url with https:// then it will use it
instead of building from the base url and then adding a extra url.

Bug: Issue 9772
Change-Id: I984204249425ba44c432794f804e0357cd5a2cfb
This commit is contained in:
Paladox none
2018-09-26 23:34:23 +00:00
parent 25828e08e0
commit 8e8466f45a
2 changed files with 7 additions and 1 deletions

View File

@@ -229,7 +229,7 @@
if (typeof link.url === 'undefined') {
return '';
}
if (link.target) {
if (link.target || !link.url.startsWith('/')) {
return link.url;
}
return this._computeRelativeURL(link.url);

View File

@@ -72,6 +72,12 @@ limitations under the License.
});
test('link URLs', () => {
assert.equal(
element._computeLinkURL({url: 'http://example.com/test'}),
'http://example.com/test');
assert.equal(
element._computeLinkURL({url: 'https://example.com/test'}),
'https://example.com/test');
assert.equal(
element._computeLinkURL({url: '/test'}),
'//' + window.location.host + '/test');