mirror of https://github.com/gorhill/uBlock.git
Fix regression in URL rules validation
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/665
Regression:
- 2f63fb3fd4
This commit is contained in:
parent
9a95fbff94
commit
874e92af2d
|
@ -65,7 +65,7 @@ CodeMirror.defineMode('ubo-dynamic-filtering', ( ) => {
|
|||
};
|
||||
|
||||
const isURLRule = ( ) => {
|
||||
return /^[\w-_]+:\/\/[^/]+\//.test(tokens[1]);
|
||||
return tokens[1].indexOf('://') > 0;
|
||||
};
|
||||
|
||||
const skipToEnd = (stream, style = null) => {
|
||||
|
@ -132,7 +132,10 @@ CodeMirror.defineMode('ubo-dynamic-filtering', ( ) => {
|
|||
return null;
|
||||
}
|
||||
// URL rule
|
||||
if ( /[^a-z_-]+/.test(token) || invalidURLRuleTypes.has(token) ) {
|
||||
if (
|
||||
/[^a-z_-]/.test(token) && token !== '*' ||
|
||||
invalidURLRuleTypes.has(token)
|
||||
) {
|
||||
return skipToEnd(stream, 'error');
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -340,8 +340,11 @@ URLNetFiltering.prototype.fromString = function(text) {
|
|||
|
||||
URLNetFiltering.prototype.validateRuleParts = function(parts) {
|
||||
if ( parts.length !== 4 ) { return; }
|
||||
if ( parts[1].indexOf('://') === -1 ) { return; }
|
||||
if ( /[^a-z_-]+/.test(parts[2]) || knownInvalidTypes.has(parts[2]) ) {
|
||||
if ( parts[1].indexOf('://') <= 0 ) { return; }
|
||||
if (
|
||||
/[^a-z_-]/.test(parts[2]) && parts[2] !== '*' ||
|
||||
knownInvalidTypes.has(parts[2])
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if ( nameToActionMap.hasOwnProperty(parts[3]) === false ) { return; }
|
||||
|
|
Loading…
Reference in New Issue