Also special case @kindle.cn as apparently that is used in China

See https://bugs.launchpad.net/calibre/+bug/1993728
This commit is contained in:
Kovid Goyal 2022-10-21 13:02:40 +05:30
parent 7fda097623
commit cafc1b44cd
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -152,7 +152,7 @@ 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 ('@kindle.com' in to or '@pbsync.com' in to):
if isinstance(to, str) and ('@kindle.com' in to or '@kindle.cn' in to or '@pbsync.com' in to):
# The PocketBook service is a total joke. It cant handle
# non-ascii, filenames that are long enough to be split up, commas, and
# the good lord alone knows what else. So use a random filename
@ -165,7 +165,7 @@ def send_mails(jobnames, callback, attachments, to_s, subjects,
# irony that they are called "tech" companies.
# https://bugs.launchpad.net/calibre/+bug/1989282
from calibre.utils.short_uuid import uuid4
if '@kindle.com' in to:
if '@kindle.com' in to or '@kindle.cn' in to:
# https://www.mobileread.com/forums/showthread.php?t=349290
from calibre.utils.filenames import ascii_filename
aname = ascii_filename(aname)