From 7507345ce93d3bbf16bde1ada74404d20c4aea27 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Fri, 7 Feb 2020 21:43:23 +0100 Subject: [PATCH] Fix encoding of custom fields in fetchmailrc --- optional/fetchmail/fetchmail.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/optional/fetchmail/fetchmail.py b/optional/fetchmail/fetchmail.py index 49e57b73..f3ee6a70 100755 --- a/optional/fetchmail/fetchmail.py +++ b/optional/fetchmail/fetchmail.py @@ -7,6 +7,7 @@ import shlex import subprocess import re import requests +import sys FETCHMAIL = """ @@ -31,7 +32,7 @@ def extract_host_port(host_and_port, default_port): def escape_rc_string(arg): - return arg.replace("\\", "\\\\").replace('"', '\\"') + return "".join("\\x%2x" % ord(char) for char in arg) def fetchmail(fetchmailrc): @@ -91,4 +92,4 @@ if __name__ == "__main__": while True: time.sleep(int(os.environ.get("FETCHMAIL_DELAY", 60))) run(os.environ.get("DEBUG", None) == "True") - + sys.stdout.flush()