Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid regex replacements in upstream rules #36

Open
jayvdb opened this issue Mar 22, 2020 · 0 comments
Open

Invalid regex replacements in upstream rules #36

jayvdb opened this issue Mar 22, 2020 · 0 comments
Labels
rulesets Mostly pertaining to upstream rulesets

Comments

@jayvdb
Copy link
Owner

jayvdb commented Mar 22, 2020

I'm pretty sure I already fixed this upstream, but possibly hasnt been released yet.

Need to detect if it has been fixed or not, so that I can run the tests in both simplify and default mode.

Or add a simple hack/fallback for default mode so it doesnt break - might be a better approach as they are likely to let more bad data slip in.

self = <tests.test_rules.TestRules testMethod=test_package__<'CIBC'>>
name = 'CIBC'
    @foreach(_get_enabled_rulesets())
    def test_package(self, name):
        ruleset = rulesets[name]
>       self._check_ruleset(ruleset)
tests/test_rules.py:116: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_rules.py:109: in _check_ruleset
    self._check_https(rv)
tests/test_rules.py:89: in _check_https
    self.assertTrue(url.startswith("https://"))
E   AssertionError: False is not true
___________________ TestRules.test_package__<'Canada Post'> ____________________
self = <tests.test_rules.TestRules testMethod=test_package__<'Canada Post'>>
name = 'Canada Post'
    @foreach(_get_enabled_rulesets())
    def test_package(self, name):
        ruleset = rulesets[name]
>       self._check_ruleset(ruleset)
tests/test_rules.py:116: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_rules.py:109: in _check_ruleset
    self._check_https(rv)
tests/test_rules.py:89: in _check_https
    self.assertTrue(url.startswith("https://"))
E   AssertionError: False is not true
__________________ TestRules.test_package__<<'Pickaweb (...>> __________________
self = <tests.test_rules.TestRules testMethod=test_package__<<'Pickaweb (...>>>
name = 'Pickaweb (partial)'
    @foreach(_get_enabled_rulesets())
    def test_package(self, name):
        ruleset = rulesets[name]
>       self._check_ruleset(ruleset)
tests/test_rules.py:116: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_rules.py:103: in _check_ruleset
    rv = https_url_rewrite(test.url, rulesets=reduced_rulesets)
https_everywhere/_rules.py:856: in https_url_rewrite
    new_url = rule[0].sub(rule[1], url)
/usr/local/lib/python3.8/re.py:325: in _subx
    template = _compile_repl(template, pattern)
/usr/local/lib/python3.8/re.py:316: in _compile_repl
    return sre_parse.parse_template(repl, pattern)
/usr/local/lib/python3.8/sre_parse.py:1015: in parse_template
    addgroup(index, len(name) + 1)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
index = 2, pos = 2
    def addgroup(index, pos):
        if index > state.groups:
>           raise s.error("invalid group reference %d" % index, pos)
E           re.error: invalid group reference 2 at position 29
/usr/local/lib/python3.8/sre_parse.py:980: error
------------------------------ Captured log call -------------------------------
WARNING  https_everywhere._rules:_rules.py:858 failed during rule re.compile('^http://support\\.pickaweb\\.co\\.uk/(assets/)') -> https://app.sirportly.com/\g<2> , input http://pickaweb.co.uk/: invalid group reference 2 at position 29
@jayvdb jayvdb changed the title Invalid regex in upstream rules Invalid regex replacements in upstream rules Mar 22, 2020
@jayvdb jayvdb added the rulesets Mostly pertaining to upstream rulesets label Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rulesets Mostly pertaining to upstream rulesets
Projects
None yet
Development

No branches or pull requests

1 participant