all: oss: ListObjects should treat prefix as a dir#968
Open
Conversation
62f50a3 to
c53873e
Compare
c53873e to
8daab2f
Compare
There was a problem hiding this comment.
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 <scbizu@gmail.com>
8daab2f to
61fed52
Compare
…tion in ListObjects methods
Member
|
LGTM |
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.
See: