From 13e5dbafd0aa539f4f161ecbe4393f77412172d8 Mon Sep 17 00:00:00 2001 From: Saugat Pachhai Date: Sat, 30 Nov 2019 19:20:32 +0545 Subject: [PATCH] s3: check for all files in given path --- dvc/remote/s3.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dvc/remote/s3.py b/dvc/remote/s3.py index 8013f9bb9..e471af617 100644 --- a/dvc/remote/s3.py +++ b/dvc/remote/s3.py @@ -209,8 +209,15 @@ class RemoteS3(RemoteBASE): def exists(self, path_info): dir_path = path_info / "" - fname = next(self._list_paths(path_info, max_items=1), "") - return path_info.path == fname or fname.startswith(dir_path.path) + + if self.isdir(dir_path): + return True + + for fname in self._list_paths(path_info): + if path_info.path == fname: + return True + + return False def makedirs(self, path_info): # We need to support creating empty directories, which means @@ -279,7 +286,7 @@ class RemoteS3(RemoteBASE): ) def walk_files(self, path_info, max_items=None): - for fname in self._list_paths(path_info, max_items): + for fname in self._list_paths(path_info / "", max_items): if fname.endswith("/"): continue