Skip to content

Commit

Permalink
add support of remote storage
Browse files Browse the repository at this point in the history
  • Loading branch information
badziyoussef committed Dec 27, 2024
1 parent 5a050b0 commit 0be2afd
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions django_mailbox/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,24 +719,22 @@ def _rehydrate(self, msg):
if encoding and encoding.lower() == 'quoted-printable':
# Cannot use `email.encoders.encode_quopri due to
# bug 14360: http://bugs.python.org/issue14360
with open(attachment.document.path, 'rb') as f:
output = BytesIO()
encode_quopri(
BytesIO(
f.read()
),
output,
quotetabs=True,
header=False,
)
new.set_payload(
output.getvalue().decode().replace(' ', '=20')
)
output = BytesIO()
encode_quopri(
BytesIO(
attachment.document.read()
),
output,
quotetabs=True,
header=False,
)
new.set_payload(
output.getvalue().decode().replace(' ', '=20')
)
del new['Content-Transfer-Encoding']
new['Content-Transfer-Encoding'] = 'quoted-printable'
else:
with open(attachment.document.path, 'rb') as f:
new.set_payload(f.read())
new.set_payload(attachment.document.read())
del new['Content-Transfer-Encoding']
encode_base64(new)
except MessageAttachment.DoesNotExist:
Expand Down

0 comments on commit 0be2afd

Please sign in to comment.