mirror of https://github.com/jumpserver/jumpserver
perf: 修复 正则匹配的 bug
parent
2333a29a56
commit
adfc22ae85
|
@ -468,7 +468,12 @@ class JSONManyToManyDescriptor:
|
||||||
elif rule_match == 'endswith':
|
elif rule_match == 'endswith':
|
||||||
res &= str(value).endswith(str(rule_value))
|
res &= str(value).endswith(str(rule_value))
|
||||||
elif rule_match == 'regex':
|
elif rule_match == 'regex':
|
||||||
res &= re.match(rule_value, value)
|
try:
|
||||||
|
matched = bool(re.match(rule_value, value))
|
||||||
|
except Exception as e:
|
||||||
|
logging.error('Error regex match: %s', e)
|
||||||
|
matched = False
|
||||||
|
res &= matched
|
||||||
elif rule_match == 'not':
|
elif rule_match == 'not':
|
||||||
res &= value != rule_value
|
res &= value != rule_value
|
||||||
elif rule['match'] == 'gte':
|
elif rule['match'] == 'gte':
|
||||||
|
|
Loading…
Reference in New Issue