Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle partial name matches in ls method #298

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: Improve comment in ls
  • Loading branch information
AdrianoKF committed Dec 17, 2024
commit 83a92551be84b3f909ee2b74bf8f627659d455a8
14 changes: 8 additions & 6 deletions src/lakefs_spec/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,14 @@ def ls(
}
)
elif isinstance(obj, ObjectInfo):
# Skip over prefix-only matches, e.g.:
# - foo/bar
# -
# - foo/bar_test.txt

# `ls("foo/bar")` should not include `bar_test.txt`
# Skip over prefix-only matches, e.g., given:
#
# foo/
# ├── bar/
# │ └── ...
# └── bar__baz.txt
#
# `ls("foo/bar")` should not include `bar__baz.txt`
if not (prefix == "" or prefix.endswith("/")) and obj.path != prefix:
nicholasjng marked this conversation as resolved.
Show resolved Hide resolved
continue

Expand Down
Loading