mirror of https://github.com/gorhill/uBlock.git
Append wildcard character only when filter starts & ends with `/`
Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/1088
This commit is contained in:
parent
65b6753c69
commit
1cb190e102
|
@ -1341,9 +1341,7 @@ dom.on(document, 'keydown', ev => {
|
||||||
if ( reSchemeOnly.test(value) ) {
|
if ( reSchemeOnly.test(value) ) {
|
||||||
value = `|${value}`;
|
value = `|${value}`;
|
||||||
} else {
|
} else {
|
||||||
if ( value.endsWith('/') ) {
|
if ( /[/?]/.test(value) === false ) {
|
||||||
value += '*';
|
|
||||||
} else if ( /[/?]/.test(value) === false ) {
|
|
||||||
value += '^';
|
value += '^';
|
||||||
}
|
}
|
||||||
value = `||${value}`;
|
value = `||${value}`;
|
||||||
|
@ -1415,7 +1413,8 @@ dom.on(document, 'keydown', ev => {
|
||||||
// Create static filter
|
// Create static filter
|
||||||
if ( target.id === 'createStaticFilter' ) {
|
if ( target.id === 'createStaticFilter' ) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
const value = staticFilterNode().value;
|
const value = staticFilterNode().value
|
||||||
|
.replace(/^((?:@@)?\/.+\/)(\$|$)/, '$1*$2');
|
||||||
// Avoid duplicates
|
// Avoid duplicates
|
||||||
if ( createdStaticFilters.hasOwnProperty(value) ) { return; }
|
if ( createdStaticFilters.hasOwnProperty(value) ) { return; }
|
||||||
createdStaticFilters[value] = true;
|
createdStaticFilters[value] = true;
|
||||||
|
|
Loading…
Reference in New Issue