diff --git a/qcloud_cos/cos_client.py b/qcloud_cos/cos_client.py index cdb30e15..05de4adf 100644 --- a/qcloud_cos/cos_client.py +++ b/qcloud_cos/cos_client.py @@ -2266,8 +2266,6 @@ def upload_file(self, Bucket, Key, LocalFilePath, PartSize=1, MAXThread=5, Enabl LocalFilePath=file_name, PartSize=10, MAXThread=10, - CacheControl='no-cache', - ContentDisposition='download.txt' ) """ file_size = os.path.getsize(LocalFilePath) diff --git a/qcloud_cos/cos_comm.py b/qcloud_cos/cos_comm.py index 388730e7..6e48353b 100644 --- a/qcloud_cos/cos_comm.py +++ b/qcloud_cos/cos_comm.py @@ -98,7 +98,7 @@ def get_md5(data): def get_content_md5(body): """计算任何输入流的md5值""" - if isinstance(body, string_types): + if isinstance(body, text_type) or isinstance(body, binary_type): return get_md5(body) elif hasattr(body, 'tell') and hasattr(body, 'seek') and hasattr(body, 'read'): file_position = body.tell() # 记录文件当前位置 @@ -359,7 +359,7 @@ def get_file_like_object_length(data): def check_object_content_length(data): """put_object接口和upload_part接口的文件大小不允许超过5G""" content_len = 0 - if type(data) is string_types: + if isinstance(data, text_type) or isinstance(data, binary_type): content_len = len(to_bytes(data)) elif hasattr(data, 'fileno') and hasattr(data, 'tell'): content_len = get_file_like_object_length(data) diff --git a/ut/test.py b/ut/test.py index 241be7b4..47f69639 100644 --- a/ut/test.py +++ b/ut/test.py @@ -651,8 +651,7 @@ def test_upload_file_multithreading(): Key=file_name, LocalFilePath=file_name, MAXThread=10, - CacheControl='no-cache', - ContentDisposition='download.txt' + EnableMD5=True ) ed = time.time() # 记录结束时间 if os.path.exists(file_name):