From 8835f465fa94f114dcf865429c0410821d365dae Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Sat, 21 Mar 2020 01:42:50 -0400 Subject: bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418) (GH-17444) (#17445) (cherry picked from commit a62ad4730c9b575f140f24074656c0257c86a09a) Co-authored-by: Matthew Rollings <1211162+stealthcopter@users.noreply.github.com> --- Lib/uu.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Lib/uu.py') diff --git a/Lib/uu.py b/Lib/uu.py index d68d29374a..3a8c31cff0 100755 --- a/Lib/uu.py +++ b/Lib/uu.py @@ -73,6 +73,13 @@ def encode(in_file, out_file, name=None, mode=None): name = '-' if mode is None: mode = 0o666 + + # + # Remove newline chars from name + # + name = name.replace('\n','\\n') + name = name.replace('\r','\\r') + # # Write the data # -- cgit v1.2.1