Skip to content

Commit fe8fc1a

Browse files
committed
Fix ls
- Fix bag: return empty list if contain one directory - Fix bag: return empty list when _ls_from_cache have not cache but have key
1 parent 8a53184 commit fe8fc1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lakefs_spec/spec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def _ls_from_cache(self, path: str, recursive: bool = False) -> list[dict[str, A
429429
result = []
430430
result.extend(files)
431431
if not result:
432-
return result
432+
return None
433433
return sorted(result, key=operator.itemgetter("name"))
434434

435435
@overload
@@ -542,7 +542,7 @@ def ls(
542542
# Retry the API call with appended slash if the current result
543543
# is just a single directory entry only (not its contents).
544544
# This is useful to allow `ls("repo/branch/dir")` calls without a trailing slash.
545-
if len(info) == 1 and info[0]["type"] == "directory":
545+
if len(info) == 1 and info[0]["type"] == "directory" and info[0]["name"] == path + "/":
546546
return self.ls(
547547
path + "/",
548548
detail=detail,

0 commit comments

Comments
 (0)