Repository navigation
[HfFileSystem] fix ls() on new empty bucket - #5097
Merged
Merged
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
This was referenced Oct 6, 2026
Contributor
|
Heads-up: with this change, a second
from huggingface_hub import HfFileSystem
fs = HfFileSystem(token=False, skip_instance_cache=True)
f = "buckets/hf-internal-testing/integration-failures/history/2026-06-02.json"
print(fs.ls(f, detail=False))
print(fs.ls(f, detail=False))On this branch: Keying the block on an empty result ( |
hanouticelina
approved these changes
Oct 7, 2026
Member
Author
|
thank you both ! |
Contributor
|
This PR has been shipped as part of the v2.2.0 release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
it was raising
FileNotFoundErroron a new empty bucket instead of returning empty list.Note
Low Risk
Narrow bucket listing semantics change with targeted tests; non-existent prefixes still fail as before.
Overview
Fixes HfFileSystem treating a newly created bucket with no objects as missing when listing the bucket root.
_list_bucket_tree_with_foldersnow raisesEntryNotFoundErroronly when a non-empty prefix returns no entries; listing the bucket root with zero objects returns an empty result instead of erroring._ls_treeseedsdircache[path] = []when a listing is empty so child-pathinfo()can resolve against the parent cache.Adds integration test
test_list_empty_bucketcovering rootls,glob,find, and that non-existent subpaths still raiseFileNotFoundError.Reviewed by Cursor Bugbot for commit e2b4518. Bugbot is set up for automated code reviews on this repo. Configure here.