diff --git a/upyun/upyun.py b/upyun/upyun.py index 40904b1..0cbd5bd 100644 --- a/upyun/upyun.py +++ b/upyun/upyun.py @@ -79,7 +79,7 @@ def put(self, key, value, checksum=False, headers=None): if headers is None: headers = {} headers['Mkdir'] = 'true' - if checksum is True: + if checksum is True and 'Content-MD5' not in headers: headers['Content-MD5'] = self.__make_content_md5(value) h = self.__do_http_request('PUT', key, value, headers) @@ -175,6 +175,9 @@ def __make_content_md5(self, value): else: raise UpYunClientException("object type error") + def make_content_md5(self, value): + return self.__make_content_md5(value) + def __get_meta_headers(self, headers): return dict(iter([(k[8:].lower(), v) for k, v in headers if k[:8].lower() == 'x-upyun-']))