Skip to content

Commit

Permalink
Folders are also considered for WalkWithObjects
Browse files Browse the repository at this point in the history
Signed-off-by: gifi-siby <[email protected]>
  • Loading branch information
“gifi-siby“ committed Jan 10, 2025
1 parent 22b8f6a commit 1a3b062
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions internal/storage/gcp_native_object_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,13 @@ func (gcs *GcpNativeObjectStorage) WalkWithObjects(ctx context.Context,
return checkObjectStorageError(prefix, err)
}
if objAttrs.Prefix != "" {
continue
}
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Name, ModifyTime: objAttrs.Updated}) {
return nil
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Prefix, ModifyTime: objAttrs.Updated}) {
return nil
}
} else if objAttrs.Name != "" {
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Name, ModifyTime: objAttrs.Updated}) {
return nil
}
}
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions internal/storage/gcp_native_object_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ func TestGcpNativeObjectStorage(t *testing.T) {
}{
{true, "abc/", []string{"abc/e/d"}},
{true, "key_/", []string{"key_/1/1", "key_/2/3", "key_/test.txt"}},
{false, "abc/", []string{}},
{false, "key_/", []string{"key_/test.txt"}},
{false, "abc/", []string{"abc/e/"}},
{false, "key_/", []string{"key_/1/", "key_/2/", "key_/test.txt"}},
}

for _, test := range insertWithPrefixTests {
Expand Down

0 comments on commit 1a3b062

Please sign in to comment.