-
Notifications
You must be signed in to change notification settings - Fork 63
all: oss: ListObjects should treat prefix as a dir
#968
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
base: main
Are you sure you want to change the base?
Conversation
62f50a3 to
c53873e
Compare
c53873e to
8daab2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures that the prefix parameter is consistently treated as a directory in all ListObjects methods by appending a trailing slash when needed.
- Introduced a
normalizePathhelper to add a trailing slash for non-empty paths. - Updated all storage backends’
ListObjectsto callnormalizePathafter joining the prefix. - Added unit tests for the new
normalizePathfunction.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| storage.go | Added normalizePath helper function |
| storage_test.go | Added unit tests for normalizePath |
| tencent.go | Applied normalizePath in ListObjects |
| oracle.go | Applied normalizePath in ListObjects |
| openstack.go | Applied normalizePath in ListObjects |
| microsoft.go | Applied normalizePath in ListObjects |
| google.go | Applied normalizePath in ListObjects |
| etcd.go | Applied normalizePath in ListObjects |
| baidu.go | Applied normalizePath in ListObjects |
| amazon.go | Applied normalizePath in ListObjects |
| alibaba.go | Applied normalizePath in ListObjects |
Comments suppressed due to low confidence (3)
storage.go:100
- [nitpick] Add a comment above
normalizePathto describe its behavior (e.g., "// normalizePath ensures a non-empty path ends with a slash").
func normalizePath(path string) string {
storage_test.go:184
- Consider adding test cases for nested paths (e.g.,
normalizePath("a/b")=> "a/b/") to improve coverage for multi-segment prefixes.
suite.Equal("prefix/", normalizePath("prefix"), "path without trailing slash normalized to path with trailing slash")
tencent.go:90
- [nitpick] This join-and-normalize pattern is repeated across multiple backends; consider extracting a helper like
joinAndNormalizePrefixto reduce duplication and ensure consistency.
prefix = normalizePath(prefix)
See: - helm/chartmuseum#1082 - helm/chartmuseum#794 Signed-off-by: scnace <[email protected]>
8daab2f to
61fed52
Compare
…tion in ListObjects methods
|
LGTM |
See: