Browse Source

Properly handle extension-less files

master
Sven Slootweg 9 years ago
parent
commit
1ac7dc9b33
  1. 4
      parse

4
parse

@ -144,9 +144,9 @@ for email_file in file_list:
attachment_sha1 = hashlib.sha1(attachment_data).hexdigest()
attachment_filename = part.get_filename()
attachment_type = part.get_content_type()
attachment_extension = os.path.splitext(attachment_filename)[1][1:]
attachment_extension = os.path.splitext(attachment_filename)[1]
attachment_size = len(attachment_data)
attachment_destination = "%s/%s.%s" % (options['attachment_dir'], attachment_sha1, attachment_extension)
attachment_destination = "%s/%s%s" % (options['attachment_dir'], attachment_sha1, attachment_extension)
attachment_list.append((attachment_filename, attachment_type, attachment_sha1, attachment_size))
attachment_file = open(attachment_destination, "w")

Loading…
Cancel
Save