From: Jim P. <ji...@gm...> - 2011-01-09 22:45:00
|
On Sun, Jan 9, 2011 at 01:35, Jobe Bittman <jo...@op...> wrote: > Were you able to see where to fix that? Hi Jobe, Here's the patch output of what I changed and tested. It's inline here so that can be verified first, rather than having a file that ppl immediate download and apply. ;-) -Jim P. $ diff -r -u S3.py.orig S3.py --- S3.py.orig 2011-01-09 17:02:16.000000000 -0500 +++ S3.py 2011-01-09 17:40:26.000000000 -0500 @@ -305,8 +305,15 @@ headers["x-amz-acl"] = "public-read" if self.config.reduced_redundancy: headers["x-amz-storage-class"] = "REDUCED_REDUNDANCY" - # if extra_headers: - # headers.update(extra_headers) + if extra_headers: + headers.update(extra_headers) + content_type = None + if self.config.guess_mime_type: + content_type = mimetypes.guess_type(src_uri.object())[0] + if not content_type: + content_type = self.config.default_mime_type + debug("Content-Type set to '%s'" % content_type) + headers["content-type"] = content_type request = self.create_request("OBJECT_PUT", uri = dst_uri, headers = headers) response = self.send_request(request) return response @@ -325,6 +332,13 @@ headers["x-amz-storage-class"] = "REDUCED_REDUNDANCY" if extra_headers: headers.update(extra_headers) + content_type = None + if self.config.guess_mime_type: + content_type = mimetypes.guess_type(src_uri.object())[0] + if not content_type: + content_type = self.config.default_mime_type + debug("Content-Type set to '%s'" % content_type) + headers["content-type"] = content_type request = self.create_request("OBJECT_PUT", uri = dst_uri, headers = headers) response = self.send_request(request) return response -Jim P. |