Fix: escape glob character

This commit is contained in:
eight 2019-03-18 17:10:30 +08:00
parent 7ad3e45513
commit e179918a96

View File

@ -358,10 +358,15 @@ function styleExcluded({exclusions}, type) {
} }
function getExcludeRule(type) { function getExcludeRule(type) {
const u = new URL(tabURL);
if (type === 'domain') { if (type === 'domain') {
return new URL(tabURL).origin + '/*'; return u.origin + '/*';
} }
return tabURL + '*'; return escapeGlob(u.origin + u.pathname) + '*';
}
function escapeGlob(text) {
return text.replace(/\*/g, '\\*');
} }
Object.assign(handleEvent, { Object.assign(handleEvent, {