From c0d33040b602446cc420113159fdaee97264d39c Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 12 Feb 2019 11:16:13 +0100 Subject: [PATCH] Fix an issue with empty hash in the href validator --- www/common/common-hash.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/common/common-hash.js b/www/common/common-hash.js index 1bdd3b702..71ad0977b 100644 --- a/www/common/common-hash.js +++ b/www/common/common-hash.js @@ -225,7 +225,7 @@ Version 1 var ret = {}; if (!href) { return ret; } - if (href.slice(-1) !== '/') { href += '/'; } + if (href.slice(-1) !== '/' && href.slice(-1) !== '#') { href += '/'; } href = href.replace(/\/\?[^#]+#/, '/#'); var idx; @@ -246,6 +246,7 @@ Version 1 if (!/^https*:\/\//.test(href)) { idx = href.indexOf('/#'); ret.type = href.slice(1, idx); + if (idx === -1) { return ret; } ret.hash = href.slice(idx + 2); ret.hashData = parseTypeHash(ret.type, ret.hash); return ret;