Add a fix-eml.py script

For trying to fix up patches mangled by Outlook

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2022-01-20 16:58:36 -05:00
parent 864963a903
commit 3a2a30af33
1 changed files with 23 additions and 0 deletions

23
fix-eml.py Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/python
import re
import sys
if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} FILE")
sys.exit(1)
with open(sys.argv[1]) as f:
line = ""
for l in f:
if len(l) == 77 and l[-2] == "=":
line += l[:-2]
else:
line += l
if not re.match("NetApp Security WARNING:", line):
line = re.sub("^\+ ", "+ ", line, count=1)
line = re.sub("^\- ", "- ", line, count=1)
line = re.sub("^ ", " ", line, count=1)
line = re.sub(" ", " ", line)
line = re.sub("=3D", "=", line)
print(line, end="")
line = ""