Skip to content

Commit

Permalink
Strip trailing slashes from both to compare.
Browse files Browse the repository at this point in the history
Add test.
  • Loading branch information
foodprocessor committed Oct 23, 2023
1 parent b2febd0 commit 7f4eada
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 9 additions & 0 deletions component/s3storage/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,15 @@ func (s *clientTestSuite) TestList() {
s.assert.EqualValues(len(objects), 1)
s.assert.EqualValues(objects[0].Name, base+"c")
s.assert.False(objects[0].IsDir())

// When listing the root, List should not include the root
objects, _, err = s.client.List("", nil, 0)
s.assert.Nil(err)
s.assert.NotNil(objects)
s.assert.Greater(len(objects), 0)
s.assert.NotEqual(objects[0].Name, "")
s.assert.NotEqual(objects[0].Name, "/")
s.assert.NotEqual(objects[0].Name, ".")
}
func (s *clientTestSuite) TestReadToFile() {
defer s.cleanupTest()
Expand Down
3 changes: 1 addition & 2 deletions component/s3storage/s3wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,7 @@ func (cl *Client) List(prefix string, marker *string, count int32) ([]*internal.
// now let's add attributes for all the directories in dirList
for dir := range dirList {
dirName, _ := cl.getFile(dir)
dirName = internal.TruncateDirName(dirName)
if dirName == listPath {
if internal.TruncateDirName(dirName) == internal.TruncateDirName(listPath) {
continue
}
path := split(cl.Config.prefixPath, dirName)
Expand Down

0 comments on commit 7f4eada

Please sign in to comment.