embed RE escape in get_maildropline
This commit is contained in:
@@ -21,7 +21,7 @@ def qmail_status(user):
|
|||||||
|
|
||||||
# try to find active filter
|
# try to find active filter
|
||||||
if re.search(
|
if re.search(
|
||||||
rf"^{re.escape(get_maildropline(user))}$", qmailfile.read(), re.MULTILINE
|
rf"^{get_maildropline(user, regex=True)}$", qmailfile.read(), re.MULTILINE
|
||||||
):
|
):
|
||||||
# if get_maildropline(user) in qmailfile.read():
|
# if get_maildropline(user) in qmailfile.read():
|
||||||
return True
|
return True
|
||||||
@@ -31,7 +31,7 @@ def qmail_status(user):
|
|||||||
|
|
||||||
# filter is deactivated (commented)
|
# filter is deactivated (commented)
|
||||||
if re.search(
|
if re.search(
|
||||||
rf"^#{re.escape(get_maildropline(user))}$",
|
rf"^#{get_maildropline(user, regex=True)}$",
|
||||||
qmailfile.read(),
|
qmailfile.read(),
|
||||||
re.MULTILINE,
|
re.MULTILINE,
|
||||||
):
|
):
|
||||||
@@ -88,8 +88,11 @@ def get_filterfile(user, name):
|
|||||||
return filepath
|
return filepath
|
||||||
|
|
||||||
|
|
||||||
def get_maildropline(user):
|
def get_maildropline(user, regex=False):
|
||||||
return f"|maildrop {get_filterfile(user, 'FOOBAR')}"
|
if regex:
|
||||||
|
return re.escape(f"|maildrop {get_filterfile(user, 'FOOBAR')}")
|
||||||
|
else:
|
||||||
|
return f"|maildrop {get_filterfile(user, 'FOOBAR')}"
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
|
|||||||
Reference in New Issue
Block a user