From 733f824844dad3dc19ae35e3c32f7699a7a5ddd6 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sat, 12 Feb 2022 13:17:19 +0900 Subject: [PATCH] feat(storage): allow specifying includeTrailingDelimiter References fsouza/fake-gcs-server#676. --- storage/bucket.go | 1 + storage/storage.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/storage/bucket.go b/storage/bucket.go index 9d145f039636..54f4b45d4dd6 100644 --- a/storage/bucket.go +++ b/storage/bucket.go @@ -1543,6 +1543,7 @@ func (it *ObjectIterator) fetch(pageSize int, pageToken string) (string, error) req.StartOffset(it.query.StartOffset) req.EndOffset(it.query.EndOffset) req.Versions(it.query.Versions) + req.IncludeTrailingDelimiter(it.query.IncludeTrailingDelimiter) if len(it.query.fieldSelection) > 0 { req.Fields("nextPageToken", googleapi.Field(it.query.fieldSelection)) } diff --git a/storage/storage.go b/storage/storage.go index 457d77c8dbc9..cca34184d590 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -1588,6 +1588,11 @@ type Query struct { // which returns all properties. Passing ProjectionNoACL will omit Owner and ACL, // which may improve performance when listing many objects. Projection Projection + + // If true, objects that end in exactly one instance of delimiter have + // their metadata included in items[] in addition to the relevant part of + // the object name appearing in prefixes[]. + IncludeTrailingDelimiter bool } // attrToFieldMap maps the field names of ObjectAttrs to the underlying field