Skip to content

Commit

Permalink
download mutliversion bug fixed (#302)
Browse files Browse the repository at this point in the history
Co-authored-by: lewzylu(卢众意) <[email protected]>
  • Loading branch information
lewzylu and lewzylu(卢众意) authored Oct 30, 2023
1 parent ec50060 commit 5eb1c08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions coscmd/cos_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,8 @@ def download_file(self, cos_path, local_path, _http_headers='{}', **kwargs):
os.makedirs(dir_path, 0o755)
except Exception as e:
pass
if kwargs["versionId"] != "":
_http_headers["VersionId"] = kwargs["versionId"]
if file_size <= self._multidownload_threshold:
try:
self._client.download_file(
Expand Down
3 changes: 2 additions & 1 deletion coscmd/cos_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ def download(args):
kwargs['include'] = args.include.split(',')
kwargs['skipmd5'] = args.skipmd5
kwargs['delete'] = args.delete
kwargs['versionId'] = args.versionId
kwargs['yes'] = args.yes
if args.recursive:
rt = Interface.download_folder(args.cos_path, args.local_path, args.headers, **kwargs)
Expand Down Expand Up @@ -793,7 +794,7 @@ def command_thread():
parser_download.add_argument('-r', '--recursive', help="Download recursively when upload directory", action="store_true", default=False)
parser_download.add_argument('-s', '--sync', help="Download and skip the same file", action="store_true", default=False)
parser_download.add_argument('-H', '--headers', help="Specify HTTP headers", type=str, default='{}')
parser_download.add_argument('--versionId', help='Specify versionId of object to list', type=str, default="")
parser_download.add_argument('--versionId', help='Specify versionId of object to download', type=str, default="")
parser_download.add_argument('--include', help='Specify filter rules, separated by commas; Example: *.txt,*.docx,*.ppt', type=str, default="*")
parser_download.add_argument('--ignore', help='Specify ignored rules, separated by commas; Example: *.txt,*.docx,*.ppt', type=str, default="")
parser_download.add_argument('--skipmd5', help='Download sync without check md5, only check filename and filesize', action="store_true", default=False)
Expand Down

0 comments on commit 5eb1c08

Please sign in to comment.