Skip to content

Commit

Permalink
Fixes #1363 - Fixes 'dict_keys' not subscriptable for remote2local with
Browse files Browse the repository at this point in the history
one local copy

_set_local_filename can be called with copy_paris as remote_list,
and "copy_pairs" is a normal dict and not a FileDict.
So, in that case, copy_pairs.keys() will be a view in py3 and so not
subscriptable.
  • Loading branch information
fviard committed Jan 27, 2025
1 parent 8ca6afe commit dae680c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions s3cmd
Original file line number Diff line number Diff line change
Expand Up @@ -1411,10 +1411,10 @@ def cmd_sync_remote2local(args):
if not os.path.isdir(deunicodise(destination_base)):
raise ParameterError("Destination is not an existing directory")
elif len(remote_list) == 1 and \
source_args[0] == remote_list[remote_list.keys()[0]].get(u'object_uri_str', ''):
source_args[0] == remote_list[next(iter(remote_list.keys()))].get(u'object_uri_str', ''):
if os.path.isdir(deunicodise(destination_base)):
raise ParameterError("Destination already exists and is a directory")
remote_list[remote_list.keys()[0]]['local_filename'] = destination_base
remote_list[next(iter(remote_list.keys()))]['local_filename'] = destination_base
return

if destination_base[-1] != os.path.sep:
Expand Down

0 comments on commit dae680c

Please sign in to comment.