]> granicus.if.org Git - python/commitdiff
unquote(): Didn't properly de-backslash-ify. This patch (adapted from
authorBarry Warsaw <barry@python.org>
Wed, 11 Sep 2002 02:32:14 +0000 (02:32 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 11 Sep 2002 02:32:14 +0000 (02:32 +0000)
Quinn Dunkan's mimelib SF patch #573204) fixes the problem.

Lib/rfc822.py

index 3d9e13f876eeacf61b74f09ff54cf63e75eed444..4f69b22aabdeb6506433d7b9baa808d2fc00c2e1 100644 (file)
@@ -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