Append wildcard character only when filter starts & ends with `/`

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/1088
This commit is contained in:
Raymond Hill 2024-03-14 13:32:36 -04:00
parent 65b6753c69
commit 1cb190e102
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 3 additions and 4 deletions

View File

@ -1341,9 +1341,7 @@ dom.on(document, 'keydown', ev => {
if ( reSchemeOnly.test(value) ) {
value = `|${value}`;
} else {
if ( value.endsWith('/') ) {
value += '*';
} else if ( /[/?]/.test(value) === false ) {
if ( /[/?]/.test(value) === false ) {
value += '^';
}
value = `||${value}`;
@ -1415,7 +1413,8 @@ dom.on(document, 'keydown', ev => {
// Create static filter
if ( target.id === 'createStaticFilter' ) {
ev.stopPropagation();
const value = staticFilterNode().value;
const value = staticFilterNode().value
.replace(/^((?:@@)?\/.+\/)(\$|$)/, '$1*$2');
// Avoid duplicates
if ( createdStaticFilters.hasOwnProperty(value) ) { return; }
createdStaticFilters[value] = true;