Browse code

Merge pull request #251 from mdomsch/bug/218

remove python-2.5-ism when guessing mimetype (bug #218)

Matt Domsch authored on 2013/12/06 06:41:39
Showing 1 changed files
... ...
@@ -412,7 +412,10 @@ class S3(object):
412 412
         content_type = self.config.mime_type
413 413
         content_encoding = None
414 414
         if filename != "-" and not content_type and self.config.guess_mime_type:
415
-            (content_type, content_encoding) = mime_magic(filename) if self.config.use_mime_magic else mimetypes.guess_type(filename)
415
+            if self.config.use_mime_magic:
416
+                (content_type, content_encoding) = mime_magic(filename)
417
+            else:
418
+                (content_type, content_encoding) = mimetypes.guess_type(filename)
416 419
         if not content_type:
417 420
             content_type = self.config.default_mime_type
418 421