Opened 3 months ago

Closed 3 months ago

#7325 closed defect (fixed)

[python-abp] Allow the parser to handle filters than begin and end with '%'

Reported by: rhowell Assignee: rhowell
Priority: P3 Milestone:
Module: Sitescripts Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/30022565

Description (last modified by rhowell)

Environment

Both python2 and python3, when trying to parse filters like: "%22banner%*%22idzone%", "%22request_id%*%22idzone%", and "%22zones%*%22popunder%" (used in https://easylist-downloads.adblockplus.org/liste_fr.txt).

How to reproduce

$ python
import abp.filters.rpy
abp.filters.rpy.line2dict("%22banner%*%22idzone%")

Observed behaviour

abp.filters.rpy.line2dict("%22banner%*%22idzone%")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "abp/filters/rpy.py", line 95, in line2dict
return strings2utf8(tuple2dict(parse_line(text, mode)))
File "abp/filters/parser.py", line 310, in parse_line
return _parse_instruction(stripped)
File "abp/filters/parser.py", line 158, in _parse_instruction
raise ParseError('Unrecognized instruction', text)
abp.filters.parser.ParseError: Unrecognized instruction in "%22banner%*%22idzone%"

Expected behaviour

Properly parse the filter:

'in': b'%22banner%*%22idzone%',
'out': {

b'type': b'Filter',
b'text': b'%22banner%*%22idzone%',
b'selector': {b'type': b'url-pattern',

b'value': b'%22banner%*%22idzone%'},

b'action': b'block',
b'options': [],

}

Change History (5)

comment:1 Changed 3 months ago by rhowell

  • Description modified (diff)

comment:2 Changed 3 months ago by rhowell

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:3 Changed 3 months ago by kvas

  • Priority changed from Unknown to P3

comment:4 Changed 3 months ago by abpbot

comment:5 Changed 3 months ago by rhowell

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.