Also use ascii filenames for @kindle.com addresses

Does no harm since filenames are not visible on Kindles anyway. Hopefully, fixes #1949604
This commit is contained in:
Kovid Goyal 2021-11-08 20:33:41 +05:30
parent 4c0138e40d
commit 4d4f55a95d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -149,8 +149,10 @@ def send_mails(jobnames, callback, attachments, to_s, subjects,
for name, attachment, to, subject, text, aname in zip(jobnames,
attachments, to_s, subjects, texts, attachment_names):
description = _('Email %(name)s to %(to)s') % dict(name=name, to=to)
if isinstance(to, str) and '@pbsync.com' in to:
if isinstance(to, str) and ('@pbsync.com' in to or '@kindle.com' in to):
# The pbsync service chokes on non-ascii filenames
# Dont know if amazon's service chokes or not, but since filenames
# arent visible on Kindles anyway, might as well be safe
aname = ascii_filename(aname)
job = ThreadedJob('email', description, gui_sendmail, (attachment, aname, to,
subject, text), {}, callback)