1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

fuzzy matching: apply fuzzy match if url prefix and regex match, even if no groups are captured by the regex (#524)

This commit is contained in:
Noah Levitt 2019-12-20 17:20:45 -08:00 committed by Ilya Kreymer
parent 0be84520ed
commit 523e35d973

View File

@ -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: