Skip to content

Commit e8f64a8

Browse files
committed
Prevent duplicated entries in find() in presence of directory markers
1 parent 2ccadeb commit e8f64a8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

s3fs/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,10 @@ async def _find(
912912
# Explicitly add directories to their parents in the dircache
913913
for d in dirs:
914914
par = self._parent(d["name"])
915-
if par in thisdircache:
915+
# extra condition here (in any()) to deal with director-marking files
916+
if par in thisdircache and not any(
917+
_["name"] == d["name"] for _ in thisdircache[par]
918+
):
916919
thisdircache[par].append(d)
917920

918921
if not prefix:

0 commit comments

Comments
 (0)