Handle glob -> regex errors
This commit is contained in:
parent
7a079adc8f
commit
d056a0a3d8
|
@ -258,6 +258,7 @@ def _glob_matches(glob, value, word_boundary=False):
|
||||||
Returns:
|
Returns:
|
||||||
bool
|
bool
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
if IS_GLOB.search(glob):
|
if IS_GLOB.search(glob):
|
||||||
r = re.escape(glob)
|
r = re.escape(glob)
|
||||||
|
|
||||||
|
@ -292,6 +293,9 @@ def _glob_matches(glob, value, word_boundary=False):
|
||||||
return r.search(value)
|
return r.search(value)
|
||||||
else:
|
else:
|
||||||
return value.lower() == glob.lower()
|
return value.lower() == glob.lower()
|
||||||
|
except re.error:
|
||||||
|
logger.warn("Failed to parse glob to regex: %r", glob)
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def _flatten_dict(d, prefix=[], result={}):
|
def _flatten_dict(d, prefix=[], result={}):
|
||||||
|
|
Loading…
Reference in New Issue