pfwb/sendmail: truncate filename coming from expedition at 230 characters
fixes #3870
This commit is contained in:
parent
705a01268f
commit
5da9a6a7ec
|
@ -158,8 +158,10 @@ In case of failure the following return value is returned:
|
|||
description = unicode(part.get_payload(decode=True), charset)
|
||||
|
||||
if filename:
|
||||
attachments.append((self.decode_filename(filename),
|
||||
part.get_payload(decode=True)))
|
||||
filename = self.decode_filename(filename)
|
||||
# be defensive, truncate at 230 characters !
|
||||
filename = filename[:230]
|
||||
attachments.append((filename, part.get_payload(decode=True)))
|
||||
else:
|
||||
url = mail.get('x-tabellio-doc-url')
|
||||
stream = urllib2.urlopen(url)
|
||||
|
@ -173,6 +175,8 @@ In case of failure the following return value is returned:
|
|||
self.error('7.7.1 The subject cannot be decoded', exit_code=3)
|
||||
try:
|
||||
name = subject.split(':', 1)[1].strip()
|
||||
# be defensive, truncate at 230 characters !
|
||||
name = name[:230]
|
||||
except IndexError:
|
||||
self.error('7.7.1 Filename cannot be extracted from the subject', exit_code=3)
|
||||
if not name.endswith('.pdf'):
|
||||
|
|
Loading…
Reference in New Issue