feat 目录监控黑名单支持正则

This commit is contained in:
yubanmeiqin9048 2023-08-10 23:03:22 +08:00 committed by GitHub
parent 9b8dc76fb0
commit 5718b33fd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
import re
import threading import threading
import traceback import traceback
from pathlib import Path from pathlib import Path
@ -157,7 +158,7 @@ class DirMonitor(_PluginBase):
# 命中过滤关键字不处理 # 命中过滤关键字不处理
if self._exclude_keywords: if self._exclude_keywords:
for keyword in self._exclude_keywords.split("\n"): for keyword in self._exclude_keywords.split("\n"):
if keyword and keyword in event_path: if keyword and re.findall(keyword, event_path):
logger.debug(f"{event_path} 命中过滤关键字 {keyword}") logger.debug(f"{event_path} 命中过滤关键字 {keyword}")
return return