Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add number to attachment name if name is None

  • Loading branch information...
commit 8892c642a5c2b1cb4cb9fe48e32e868b40d08d8b 1 parent 0d10815
@stefanw authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 froide/foirequest/models.py
View
4 froide/foirequest/models.py
@@ -526,13 +526,13 @@ def add_message_from_email(self, email, mail_string):
self.last_message = message.timestamp
self.save()
has_pdf = False
- for attachment in email['attachments']:
+ for i, attachment in enumerate(email['attachments']):
att = FoiAttachment(belongs_to=message,
name=attachment.name,
size=attachment.size,
filetype=attachment.content_type)
if att.name is None:
- att.name = _("attached_file")
+ att.name = _("attached_file_%d") % i
att.name = re.sub('[^\w\.\-]', '', att.name)
if att.name.endswith('pdf') or 'pdf' in att.filetype:
has_pdf = True
Please sign in to comment.
Something went wrong with that request. Please try again.