Skip to content

Commit 1109444

Browse files
author
Pasu Chan
committed
Fix wildcard matching logic
1 parent 14b0e0b commit 1109444

File tree

1 file changed

+5
-2
lines changed
  • test/rules/src/https_everywhere_checker

1 file changed

+5
-2
lines changed

test/rules/src/https_everywhere_checker/rules.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,11 @@ def getCoverageProblems(self):
271271
if not "*" in target and not self.excludes(("http://%s/" % target)):
272272
continue
273273

274-
# '*.example.com' match 'www.example.com' but not 'secure.account.exmple.com'
275-
pattern = target.replace('.', '\.').replace('*', '[^\.]+')
274+
# According to the logic in rules.js available at
275+
# EFForg/https-everywhere/blob/master/chromium/rules.js#L350-L355
276+
#
277+
# `*.example.com` matches `bar.example.com` and `foo.bar.example.com` etc.
278+
pattern = target.replace('.', '\.').replace('*', '.+')
276279
pattern = '^' + pattern + '$'
277280

278281
for test in myTestTargets:

0 commit comments

Comments
 (0)