From 59bcf25b5be3d370fef5e66baf286cb5abd1c582 Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Wed, 19 Jun 2024 14:37:26 +0200 Subject: [PATCH] fix warnings (cherry picked from commit 2b6daf6157a681a44e297a18f798e300245dd59e) --- core/admin/mailu/internal/views/postfix.py | 4 ++-- core/admin/mailu/ui/forms.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py index cc8a0950..c2399cf7 100644 --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -14,7 +14,7 @@ def postfix_dane_map(domain_name): @internal.route("/postfix/domain/") def postfix_mailbox_domain(domain_name): - if re.match("^\[.*\]$", domain_name): + if re.match(r'^\[.*\]$', domain_name): return flask.abort(404) domain = models.Domain.query.get(domain_name) or \ models.Alternative.query.get(domain_name) or \ @@ -39,7 +39,7 @@ def postfix_alias_map(alias): @internal.route("/postfix/transport/") def postfix_transport(email): - if email == '*' or re.match("(^|.*@)\[.*\]$", email): + if email == '*' or re.match(r'(^|.*@)\[.*\]$', email): return flask.abort(404) _, domain_name = models.Email.resolve_domain(email) relay = models.Relay.query.get(domain_name) or flask.abort(404) diff --git a/core/admin/mailu/ui/forms.py b/core/admin/mailu/ui/forms.py index b6c45189..798bd923 100644 --- a/core/admin/mailu/ui/forms.py +++ b/core/admin/mailu/ui/forms.py @@ -7,7 +7,7 @@ import flask_wtf import re import ipaddress -LOCALPART_REGEX = "^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*$" +LOCALPART_REGEX = r'^[a-zA-Z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+/=?^_`{|}~-]+)*$' class DestinationField(fields.SelectMultipleField): """ Allow for multiple emails selection from current user choices and