[chrome/nav] be less defensive, fail fast
This commit is contained in:
parent
f0fe7f95af
commit
237a9e2f8a
|
@ -46,7 +46,7 @@ export default function (chrome, internals) {
|
||||||
function getAppId(url) {
|
function getAppId(url) {
|
||||||
const pathname = parse(url).pathname;
|
const pathname = parse(url).pathname;
|
||||||
const pathnameWithoutBasepath = pathname.slice(chrome.getBasePath().length);
|
const pathnameWithoutBasepath = pathname.slice(chrome.getBasePath().length);
|
||||||
const match = String(pathnameWithoutBasepath).match(/^\/app\/([^\/]+)(?:\/|\?|#|$)/);
|
const match = pathnameWithoutBasepath.match(/^\/app\/([^\/]+)(?:\/|\?|#|$)/);
|
||||||
if (match) return match[1];
|
if (match) return match[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue