Repository navigation
Return relative names from DirFileSystem glob and find - #2127
Merged
martindurant merged 2 commits intoSep 11, 2026
Merged
Conversation
| for path, info in paths.items(): | ||
| path = self._relpath(path) | ||
| info = info.copy() | ||
| if "name" in info: |
Member
There was a problem hiding this comment.
Should probably always do this?
Contributor
Author
There was a problem hiding this comment.
Yes, that makes sense. I removed the guard so every entry gets a relative name, including when the backend returns empty metadata. The metadata is still copied, leaving the backend's result unchanged. Updated the sync/async tests and the TAR case, which also checks that the returned name can be used to read the file.
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.
Summary
DirFileSystem.glob(..., detail=True)andfind(..., detail=True)return relative dictionary keys but leave each entry'snameprefixed with the wrapped directory. Passing that name back to the same filesystem adds the root again, so listing a file and then reading it by its returned name fails.This change sets each entry's
nameto its relative dictionary key in both synchronous and asynchronous listings, matching the existinginfo()andls()convention. Each metadata dictionary is copied so the wrapped filesystem's results are left unchanged. Entries without aname, including the empty metadata returned for a single TAR file, now receive the relative name as well. Non-detailed results are unchanged.Like the earlier
info()fix in #1798, this keeps names usable through the wrapper. This PR is limited toglob()andfind();walk(), path joining and root-path conventions are unchanged. Code that used these metadata names directly with the underlying filesystem should instead use the wrapper or explicitly add the root.Tests
nameand check that the wrapped metadata is not modified.name, and compare with the non-detailed listing andinfo()name.The full Docker/FUSE/cloud/downstream matrix was not run locally.