Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect content-header assignment and charset bug #249

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions S3/S3.py
Expand Up @@ -406,19 +406,19 @@ def object_put(self, filename, uri, extra_headers = None, extra_label = ""):

## MIME-type handling
content_type = self.config.mime_type
content_encoding = None
content_charset = None
if filename != "-" and not content_type and self.config.guess_mime_type:
(content_type, content_encoding) = mime_magic(filename)
(content_type, content_charset) = mime_magic(filename)
if not content_type:
content_type = self.config.default_mime_type
if not content_charset:
content_charset = self.config.encoding.upper()

## add charset to content type
if self.add_encoding(filename, content_type):
content_type = content_type + "; charset=" + self.config.encoding.upper()
if self.add_encoding(filename, content_type) and content_charset is not None:
content_type = content_type + "; charset=" + content_charset

headers["content-type"] = content_type
if content_encoding is not None:
headers["content-encoding"] = content_encoding

## Other Amazon S3 attributes
if self.config.acl_public:
Expand Down