Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
21191d3e
Commit
21191d3e
authored
Mar 10, 2003
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get_payload(): If we get a low-level binascii.Error when base64
decoding the payload, just return it as-is.
parent
3efb651e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
Lib/email/Message.py
Lib/email/Message.py
+12
-5
No files found.
Lib/email/Message.py
View file @
21191d3e
...
...
@@ -5,13 +5,14 @@
"""
import
re
import
binascii
import
warnings
from
cStringIO
import
StringIO
from
types
import
ListType
,
TupleType
,
StringType
# Intrapackage imports
from
email
import
Errors
from
email
import
Utils
from
email
import
Errors
from
email
import
Charset
SEMISPACE
=
'; '
...
...
@@ -169,9 +170,11 @@ class Message:
Content
-
Transfer
-
Encoding
header
.
When
True
and
the
message
is
not
a
multipart
,
the
payload
will
be
decoded
if
this
header
's value is
`quoted-printable'
or
`
base64
'. If some other encoding is used, or
the header is missing, the payload is returned as-is (undecoded). If
the message is a multipart and the decode flag is True, then None is
returned.
the header is missing, or if the payload has bogus base64 data, the
payload is returned as-is (undecoded).
If the message is a multipart and the decode flag is True, then None
is returned.
"""
if i is None:
payload = self._payload
...
...
@@ -186,7 +189,11 @@ class Message:
if cte.lower() == '
quoted
-
printable
':
return Utils._qdecode(payload)
elif cte.lower() == '
base64
':
return Utils._bdecode(payload)
try:
return Utils._bdecode(payload)
except binascii.Error:
# Incorrect padding
return payload
# Everything else, including encodings with 8bit or 7bit are returned
# unchanged.
return payload
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment