1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-17 17:57:23 +01:00

Fixed RUF039 (unraw-re-pattern)

This commit is contained in:
Teal Dulcet
2025-01-12 07:27:27 -08:00
parent b305871051
commit 6883f1d599
5 changed files with 12 additions and 12 deletions

View File

@@ -635,7 +635,7 @@ def load_pem(pem):
from cryptography.x509 import load_pem_x509_certificate
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.backends import default_backend
pem_type = re.match(b"-+BEGIN (.*?)-+[\r\n]", pem)
pem_type = re.match(br"-+BEGIN (.*?)-+[\r\n]", pem)
if pem_type is None:
msg = "File is not a valid PEM-formatted file."
raise ValueError(msg)

View File

@@ -947,7 +947,7 @@ def get_latest_miab_version():
from urllib.request import urlopen, HTTPError, URLError
try:
return re.search(b'TAG=(.*)', urlopen("https://mailinabox.email/setup.sh?ping=1", timeout=5).read()).group(1).decode("utf8")
return re.search(br'TAG=(.*)', urlopen("https://mailinabox.email/setup.sh?ping=1", timeout=5).read()).group(1).decode("utf8")
except (TimeoutError, HTTPError, URLError):
return None
@@ -1074,7 +1074,7 @@ class FileOutput:
def print_block(self, message, first_line=" "):
print(first_line, end='', file=self.buf)
message = re.sub("\n\\s*", " ", message)
message = re.sub(r"\n\s*", " ", message)
words = re.split(r"(\s+)", message)
linelen = 0
for w in words:

View File

@@ -223,7 +223,7 @@ def make_domain_config(domain, templates, ssl_certificates, env):
# of the previous template.
nginx_conf = "# ADDITIONAL DIRECTIVES HERE\n"
for t in [*templates, nginx_conf_extra]:
nginx_conf = re.sub("[ \t]*# ADDITIONAL DIRECTIVES HERE *\n", t, nginx_conf)
nginx_conf = re.sub(r"[ \t]*# ADDITIONAL DIRECTIVES HERE *\n", t, nginx_conf)
# Replace substitution strings in the template & return.
nginx_conf = nginx_conf.replace("$STORAGE_ROOT", env['STORAGE_ROOT'])