summaryrefslogtreecommitdiffstats
path: root/Lib/rfc822.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-09-11 02:32:14 (GMT)
committerBarry Warsaw <barry@python.org>2002-09-11 02:32:14 (GMT)
commit4e09d5c6d6f5e3eaf8175c0ec54901b6f7a005a1 (patch)
tree7e675b38bdd420775b7c511fa30da97501d92551 /Lib/rfc822.py
parentbc6edac8dfc01360ee98541c8a0374bb91753dc6 (diff)
downloadcpython-4e09d5c6d6f5e3eaf8175c0ec54901b6f7a005a1.zip
cpython-4e09d5c6d6f5e3eaf8175c0ec54901b6f7a005a1.tar.gz
cpython-4e09d5c6d6f5e3eaf8175c0ec54901b6f7a005a1.tar.bz2
unquote(): Didn't properly de-backslash-ify. This patch (adapted from
Quinn Dunkan's mimelib SF patch #573204) fixes the problem.
Diffstat (limited to 'Lib/rfc822.py')
-rw-r--r--Lib/rfc822.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/rfc822.py b/Lib/rfc822.py
index 3d9e13f..4f69b22 100644
--- a/Lib/rfc822.py
+++ b/Lib/rfc822.py
@@ -477,9 +477,9 @@ class Message:
def unquote(str):
"""Remove quotes from a string."""
if len(str) > 1:
- if str[0] == '"' and str[-1:] == '"':
- return str[1:-1]
- if str[0] == '<' and str[-1:] == '>':
+ if str.startswith('"') and str.endswith('"'):
+ return str[1:-1].replace('\\\\', '\\').replace('\\"', '"')
+ if str.startswith('<') and str.endswith('>'):
return str[1:-1]
return str