Fix a bug in s3 log uploader with .gz files
When trying to upload .gz files, we do not set the ContentEncoding argument to upload_fileobj but leave it as None. The upload then fails because NoneType is not allowed. Therefore, leave out this parameter, and also the ContentType parameter, from the extra args completely if they are not set. Change-Id: I601944ac83d5e823aa4dcfd0db880a38474288af
This commit is contained in:
parent
73481298e3
commit
1ab9ca3ed9
@ -169,10 +169,11 @@ class Uploader():
|
|||||||
content_encoding = file_detail.encoding
|
content_encoding = file_detail.encoding
|
||||||
data = open(file_detail.full_path, 'rb')
|
data = open(file_detail.full_path, 'rb')
|
||||||
|
|
||||||
extra_args = dict(
|
extra_args = {}
|
||||||
ContentType=file_detail.mimetype,
|
if file_detail.mimetype:
|
||||||
ContentEncoding=content_encoding
|
extra_args['ContentType'] = file_detail.mimetype
|
||||||
)
|
if content_encoding:
|
||||||
|
extra_args['ContentEncoding'] = content_encoding
|
||||||
if self.public:
|
if self.public:
|
||||||
extra_args['ACL'] = 'public-read'
|
extra_args['ACL'] = 'public-read'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user