From 523e35d9735bf5b4aa205a2f8ccdf1a73d66a665 Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Fri, 20 Dec 2019 17:20:45 -0800 Subject: [PATCH] fuzzy matching: apply fuzzy match if url prefix and regex match, even if no groups are captured by the regex (#524) --- pywb/warcserver/index/fuzzymatcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pywb/warcserver/index/fuzzymatcher.py b/pywb/warcserver/index/fuzzymatcher.py index 618b64f2..178c2ce4 100644 --- a/pywb/warcserver/index/fuzzymatcher.py +++ b/pywb/warcserver/index/fuzzymatcher.py @@ -84,7 +84,7 @@ class FuzzyMatcher(object): m = rule.regex.search(urlkey) groups = m and m.groups() - if not groups: + if groups is None: continue matched_rule = rule @@ -99,7 +99,7 @@ class FuzzyMatcher(object): # 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: