Use raw byte string for regex

Fixes SyntaxWarning in Python 3.12 due to invalid escape sequence.
This commit is contained in:
Simon Chopin
2024-03-07 16:51:24 +01:00
parent 92902fc9cd
commit 073a0a1169
+1 -1
View File
@@ -302,7 +302,7 @@ def validate_signature_fields(sig, mandatory_fields=[b'v', b'a', b'b', b'bh', b'
try: try:
str(sig[b'd'], 'ascii') str(sig[b'd'], 'ascii')
# No specials, which is close enough # No specials, which is close enough
if re.findall(b"[\(\)<>\[\]:;@\\,]", sig[b'd']): if re.findall(rb"[\(\)<>\[\]:;@\\,]", sig[b'd']):
raise ValidationError("d= value is not valid (%s)" % sig[b'd']) raise ValidationError("d= value is not valid (%s)" % sig[b'd'])
except UnicodeDecodeError as e: except UnicodeDecodeError as e:
# Not an ASCII domain # Not an ASCII domain