aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/gcs
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gcs')
-rw-r--r--pkg/gcs/gcs.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkg/gcs/gcs.go b/pkg/gcs/gcs.go
index 756d2c65d..c9e62c86e 100644
--- a/pkg/gcs/gcs.go
+++ b/pkg/gcs/gcs.go
@@ -175,8 +175,14 @@ type Object struct {
CreatedAt time.Time
}
-func (client *Client) ListObjects(bucket string) ([]*Object, error) {
- it := client.client.Bucket(bucket).Objects(client.ctx, nil)
+// ListObjects expects "bucket/path" or "bucket" as input.
+func (client *Client) ListObjects(bucketObjectPath string) ([]*Object, error) {
+ bucket, objectPath, err := split(bucketObjectPath)
+ if err != nil { // no path specified
+ bucket = bucketObjectPath
+ }
+ query := &storage.Query{Prefix: objectPath}
+ it := client.client.Bucket(bucket).Objects(client.ctx, query)
ret := []*Object{}
for {
objAttrs, err := it.Next()