Skip to content

Commit

Permalink
fuzzy matching: apply fuzzy match if url prefix and regex match, even…
Browse files Browse the repository at this point in the history
… if no groups are captured by the regex (#524)
  • Loading branch information
nlevitt authored and ikreymer committed Dec 21, 2019
1 parent 0be8452 commit 523e35d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pywb/warcserver/index/fuzzymatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_fuzzy_match(self, urlkey, url, params):
m = rule.regex.search(urlkey)
groups = m and m.groups()

if not groups:
if groups is None:
continue

matched_rule = rule
Expand All @@ -99,7 +99,7 @@ def get_fuzzy_match(self, urlkey, url, params):

# support matching w/o query if no additional filters
# don't include trailing '?' if no filters and replace_after '?'
no_filters = (filters == {'urlkey:'}) and (matched_rule.replace_after == '?')
no_filters = (not filters or filters == {'urlkey:'}) and (matched_rule.replace_after == '?')

inx = url.find(matched_rule.replace_after)
if inx > 0:
Expand Down

0 comments on commit 523e35d

Please sign in to comment.