Skip to content

Commit 363bcd4

Browse files
committed
Bucket: add prefix support for GCP
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
1 parent 6d4e654 commit 363bcd4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

docs/spec/v1beta2/buckets.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,8 @@ details and examples.
790790
`.spec.prefix` is an optional field to enable server-side filtering
791791
of files in the Bucket.
792792

793-
**Note:** The server-side filtering works only with the `generic` and `aws`
794-
[provider](#provider) and is preferred over [`.spec.ignore`](#ignore)
793+
**Note:** The server-side filtering works only with the `generic`, `aws`
794+
and `gcp` [provider](#provider) and is preferred over [`.spec.ignore`](#ignore)
795795
as a more efficient way of excluding files.
796796

797797
### Ignore

pkg/gcp/gcp.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ func (c *GCSClient) FGetObject(ctx context.Context, bucketName, objectName, loca
166166
// If the underlying client or the visit callback returns an error,
167167
// it returns early.
168168
func (c *GCSClient) VisitObjects(ctx context.Context, bucketName string, prefix string, visit func(path, etag string) error) error {
169-
items := c.Client.Bucket(bucketName).Objects(ctx, nil)
169+
items := c.Client.Bucket(bucketName).Objects(ctx, &gcpstorage.Query{
170+
Prefix: prefix,
171+
Delimiter: "/",
172+
})
170173
for {
171174
object, err := items.Next()
172175
if err == IteratorDone {

0 commit comments

Comments
 (0)