Merge "gr-dropdown: Prevent adding base url twice in _computeURLHelper" into stable-2.16
diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js
index 3d9d36b..974f179 100644
--- a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js
+++ b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js
@@ -198,14 +198,16 @@
},
/**
- * Build a URL for the given host and path. If there is a base URL, it will
- * be included between the host and the path.
+ * Build a URL for the given host and path. The base URL will be only added,
+ * if it is not already included in the path.
* @param {!string} host
* @param {!string} path
* @return {!string} The scheme-relative URL.
*/
_computeURLHelper(host, path) {
- return '//' + host + this.getBaseUrl() + path;
+ const base = path.startsWith(this.getBaseUrl()) ?
+ '' : this.getBaseUrl();
+ return '//' + host + base + path;
},
/**