Support user-defined content-type header #16

Closed
wants to merge 3 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+8 −7
Split
View
@@ -349,13 +349,14 @@ 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: