[chrome/nav] be less defensive, fail fast

This commit is contained in:
spalger 2016-03-28 13:40:56 -07:00
parent f0fe7f95af
commit 237a9e2f8a

View file

@ -46,7 +46,7 @@ export default function (chrome, internals) {
function getAppId(url) {
const pathname = parse(url).pathname;
const pathnameWithoutBasepath = pathname.slice(chrome.getBasePath().length);
const match = String(pathnameWithoutBasepath).match(/^\/app\/([^\/]+)(?:\/|\?|#|$)/);
const match = pathnameWithoutBasepath.match(/^\/app\/([^\/]+)(?:\/|\?|#|$)/);
if (match) return match[1];
}