mirror of
https://github.com/chatmail/relay.git
synced 2026-08-29 19:43:14 +00:00
Improve filtermail checks for encrypted messages
Ensure that first part only contains "Version: 1" and second part only contains base64 payload enclosed in "-----BEGIN PGP MESSAGE-----" and "-----END PGP MESSAGE-----".
This commit is contained in:
@@ -68,7 +68,9 @@ def maildata(request):
|
||||
assert datadir.exists(), datadir
|
||||
|
||||
def maildata(name, from_addr, to_addr):
|
||||
data = datadir.joinpath(name).read_text()
|
||||
# Using `.read_bytes().decode()` instead of `.read_text()` to preserve newlines.
|
||||
data = datadir.joinpath(name).read_bytes().decode()
|
||||
|
||||
text = data.format(from_addr=from_addr, to_addr=to_addr)
|
||||
return BytesParser(policy=policy.default).parsebytes(text.encode())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user