Skip to content

Commit

Permalink
Prevent UnicodeDecodeError when attempting to base64-decode the entry…
Browse files Browse the repository at this point in the history
… title

Fixes #277
  • Loading branch information
kurtmckee committed Jun 13, 2021
1 parent e4b5690 commit 36c3b7f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions NEWS
@@ -1,5 +1,9 @@
coming in the next release:

6.0.4 - 13 June 2021
* Prevent a UnicodeDecodeError crash that may occur when
the title element's type attribute exists but is empty. (#277)

6.0.3 - 12 June 2021
* Fix an issue with the HTTP request status on Python >= 3.9.

Expand Down
4 changes: 1 addition & 3 deletions feedparser/mixin.py
Expand Up @@ -506,9 +506,7 @@ def pop(self, element, strip_whitespace=1):
if base64 and self.contentparams.get('base64', 0):
try:
output = base64.decodebytes(output.encode('utf8')).decode('utf8')
except binascii.Error:
pass
except binascii.Incomplete:
except (binascii.Error, binascii.Incomplete, UnicodeDecodeError):
pass

# resolve relative URIs
Expand Down

0 comments on commit 36c3b7f

Please sign in to comment.