properly encode UTF-8

This commit is contained in:
Stefan Bethke 2024-06-04 18:58:35 +02:00
parent 7a367cd8de
commit d72f7d7b10

View file

@ -232,7 +232,7 @@ class HedgedocExpire:
''')))
md = MIMEBase('text', 'markdown')
md.add_header('Content-Disposition', f'attachment; filename={note["title"]}.md')
md.set_payload(note["content"])
md.set_payload(note["content"].encode(encoding='utf-8'))
msg.attach(md)
self.email_sender.send(msg)
@ -243,7 +243,7 @@ class HedgedocExpire:
url = self.config.url + '/' + (note["alias"] if note["alias"] is not None else note["shortid"])
print(f'Note "{note["title"]}" ({url}) emailed to {msg["To"]}')
except Exception as e:
print(f'Unable to send email to {note["email"]}: {e}', file=sys.stderr)
print(f'Unable to send email to {self.email_from_email_or_profile(note)}: {e}', file=sys.stderr)
def expire_old_revisions(self, db) -> None:
"""