mirror of
https://github.com/minio/minio.git
synced 2025-11-21 18:26:04 -05:00
Implement proper delimiter and prefix handling
With this change Minio server now responds with, delimited
'object names' in conjunction with prefix filtering
~~~
<ListBucketResult>
<Name>example-bucket</Name>
<Prefix></Prefix>
<Marker></Marker>
<MaxKeys>1000</MaxKeys>
<Delimiter>/</Delimiter>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>sample.html</Key>
<LastModified>2011-02-26T01:56:20.000Z</LastModified>
<ETag>example-bucket#sample.html</ETag>
<Size>142863</Size>
<Owner>
<ID>minio</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<CommonPrefixes>
<Prefix>photos/</Prefix>
</CommonPrefixes>
</ListBucketResult>
~~~
~~~
<ListBucketResult>
<Name>example-bucket</Name>
<Prefix>photos/2006/</Prefix>
<Marker></Marker>
<MaxKeys>1000</MaxKeys>
<Delimiter>/</Delimiter>
<IsTruncated>false</IsTruncated>
<CommonPrefixes>
<Prefix>photos/2006/feb/</Prefix>
</CommonPrefixes>
<CommonPrefixes>
<Prefix>photos/2006/jan/</Prefix>
</CommonPrefixes>
</ListBucketResult>
~~~
This commit is contained in:
@@ -34,10 +34,8 @@ type ObjectListResponse struct {
|
||||
MaxKeys int
|
||||
Delimiter string
|
||||
IsTruncated bool
|
||||
Contents []*Item `xml:,innerxml`
|
||||
CommonPrefixes struct {
|
||||
Prefix string
|
||||
} `xml:,innerxml`
|
||||
Contents []*Item `xml:,innerxml`
|
||||
CommonPrefixes []*Prefix `xml:,innerxml`
|
||||
}
|
||||
|
||||
// Bucket list response format
|
||||
@@ -49,6 +47,10 @@ type BucketListResponse struct {
|
||||
} `xml:,innerxml` // Buckets are nested
|
||||
}
|
||||
|
||||
type Prefix struct {
|
||||
Prefix string
|
||||
}
|
||||
|
||||
// Bucket struct
|
||||
type Bucket struct {
|
||||
Name string
|
||||
|
||||
Reference in New Issue
Block a user