Skip to content

Commit c6e3551

Browse files
author
“gifi-siby“
committed
Folders are also considered for WalkWithObjects
Signed-off-by: “gifi-siby“ <[email protected]>
1 parent 22b8f6a commit c6e3551

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

internal/storage/gcp_native_object_storage.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,13 @@ func (gcs *GcpNativeObjectStorage) WalkWithObjects(ctx context.Context,
170170
return checkObjectStorageError(prefix, err)
171171
}
172172
if objAttrs.Prefix != "" {
173-
continue
174-
}
175-
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Name, ModifyTime: objAttrs.Updated}) {
176-
return nil
173+
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Prefix, ModifyTime: objAttrs.Updated}) {
174+
return nil
175+
}
176+
} else if objAttrs.Name != "" {
177+
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Name, ModifyTime: objAttrs.Updated}) {
178+
return nil
179+
}
177180
}
178181
}
179182
return nil

internal/storage/gcp_native_object_storage_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ func TestGcpNativeObjectStorage(t *testing.T) {
174174
}{
175175
{true, "abc/", []string{"abc/e/d"}},
176176
{true, "key_/", []string{"key_/1/1", "key_/2/3", "key_/test.txt"}},
177-
{false, "abc/", []string{}},
178-
{false, "key_/", []string{"key_/test.txt"}},
177+
{false, "abc/", []string{"abc/e/"}},
178+
{false, "key_/", []string{"key_/1/", "key_/2/", "key_/test.txt"}},
179179
}
180180

181181
for _, test := range insertWithPrefixTests {

0 commit comments

Comments
 (0)