Skip to content

Commit

Permalink
Improve if logic even moar
Browse files Browse the repository at this point in the history
  • Loading branch information
wlach committed May 20, 2024
1 parent 1125b53 commit e2a674e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions flask_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ def force_text(s, encoding="utf-8", errors="strict"):
return s

try:
if isinstance(s, bytes):
if isinstance(s, str):
s = s.decode(encoding, errors)
elif isinstance(s, bytes):
s = str(s, encoding, errors)
elif not isinstance(s, str):
s = str(s)
else:
s = s.decode(encoding, errors)
s = str(s)
except UnicodeDecodeError as e:
if not isinstance(s, Exception):
raise FlaskMailUnicodeDecodeError(s, *e.args) from e
Expand Down

0 comments on commit e2a674e

Please sign in to comment.