mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
unquote(): Didn't properly de-backslash-ify. This patch (adapted from
Quinn Dunkan's mimelib SF patch #573204) fixes the problem.
This commit is contained in:
parent
bc6edac8df
commit
4e09d5c6d6
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue