1. Simone Marzola
  2. tgext.datahelpers

Commits

Simone Marzola  committed 21ba547

set the s3_key mime-type if the uploaded file is a cgi.FieldStorage instance

  • Participants
  • Parent commits be337f7
  • Branches s3

Comments (0)

Files changed (1)

File tgext/datahelpers/remote_attachments.py

View file
  • Ignore whitespace
         return self.s3_key.generate_url(config.get('s3_expire', 3600))
 
     def write(self):
+        if getattr(self.file, 'type', None):
+            self.s3_key.set_metadata('Content-Type', self.file.type)
         self.s3_key.set_contents_from_file(self.file, policy='public-read')
         self.file.seek(0)