Fix dash escaping to be applied unconditionally

According to RFC 4880, 'an implementation MAY dash-escape any line,
SHOULD dash-escape lines commencing "From" followed by a space [...]'.
Therefore it is necessary to unescape all lines starting with dash-space
sequences, and not just these that have a dash following this sequence.

Fixes #341

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2020-08-26 07:30:39 +02:00
parent 8e1407de54
commit 59c4050088
2 changed files with 34 additions and 1 deletions

View File

@@ -844,7 +844,7 @@ class PGPUID(ParentRef):
class PGPMessage(Armorable, PGPObject):
@staticmethod
def dash_unescape(text):
return re.subn(r'^- -', '-', text, flags=re.MULTILINE)[0]
return re.subn(r'^- ', '', text, flags=re.MULTILINE)[0]
@staticmethod
def dash_escape(text):