Permalink
Browse files

Check for pre-set content-type header before autodetection

  • Loading branch information...
1 parent d882e50 commit 75c21094de5c099de36150c46f757ae2d748cf54 @jarkkorantala jarkkorantala committed Dec 15, 2011
Showing with 9 additions and 7 deletions.
  1. +9 −7 S3/S3.py
View
@@ -349,13 +349,15 @@ def object_put(self, filename, uri, extra_headers = None, extra_label = ""):
if extra_headers:
headers.update(extra_headers)
headers["content-length"] = size
- content_type = self.config.mime_type
- if not content_type and self.config.guess_mime_type:
- content_type = mime_magic(filename)
- if not content_type:
- content_type = self.config.default_mime_type
- debug("Content-Type set to '%s'" % content_type)
- headers["content-type"] = content_type
+ if not "content-type" in headers:
+ content_type = self.config.mime_type
+ if not content_type and self.config.guess_mime_type:
+ content_type = mime_magic(filename)
+ if not content_type:
+ content_type = self.config.default_mime_type
+ headers["content-type"] = content_type
+ debug("Content-Type set to '%s'" % content_type)
+
if self.config.acl_public:
headers["x-amz-acl"] = "public-read"
if self.config.reduced_redundancy:

0 comments on commit 75c2109

Please sign in to comment.