mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
XL: ListObjects should not list when delimiter and prefix are '/'. (#1777)
This commit is contained in:
parent
27cc8a6529
commit
ba8bdec077
9
fs-v1.go
9
fs-v1.go
@ -338,6 +338,15 @@ func (fs fsObjects) listObjectsFS(bucket, prefix, marker, delimiter string, maxK
|
|||||||
return ListObjectsInfo{}, nil
|
return ListObjectsInfo{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For delimiter and prefix as '/' we do not list anything at all
|
||||||
|
// since according to s3 spec we stop at the 'delimiter'
|
||||||
|
// along // with the prefix. On a flat namespace with 'prefix'
|
||||||
|
// as '/' we don't have any entries, since all the keys are
|
||||||
|
// of form 'keyName/...'
|
||||||
|
if delimiter == slashSeparator && prefix == slashSeparator {
|
||||||
|
return ListObjectsInfo{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Over flowing count - reset to maxObjectList.
|
// Over flowing count - reset to maxObjectList.
|
||||||
if maxKeys < 0 || maxKeys > maxObjectList {
|
if maxKeys < 0 || maxKeys > maxObjectList {
|
||||||
maxKeys = maxObjectList
|
maxKeys = maxObjectList
|
||||||
|
@ -413,6 +413,12 @@ func testListObjects(obj ObjectLayer, instanceType string, t *testing.T) {
|
|||||||
{Name: "obj2"},
|
{Name: "obj2"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// ListObjectsResult-30.
|
||||||
|
// Prefix and Delimiter is set to '/', (testCase 62).
|
||||||
|
{
|
||||||
|
IsTruncated: false,
|
||||||
|
Objects: []ObjectInfo{},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
@ -521,6 +527,8 @@ func testListObjects(obj ObjectLayer, instanceType string, t *testing.T) {
|
|||||||
// Test with marker set as hierarhical value and with delimiter. (60-61)
|
// Test with marker set as hierarhical value and with delimiter. (60-61)
|
||||||
{"test-bucket-list-object", "", "Asia/India/India-summer-photos-1", "/", 10, resultCases[28], nil, true},
|
{"test-bucket-list-object", "", "Asia/India/India-summer-photos-1", "/", 10, resultCases[28], nil, true},
|
||||||
{"test-bucket-list-object", "", "Asia/India/Karnataka/Bangalore/Koramangala/pics", "/", 10, resultCases[29], nil, true},
|
{"test-bucket-list-object", "", "Asia/India/Karnataka/Bangalore/Koramangala/pics", "/", 10, resultCases[29], nil, true},
|
||||||
|
// Test with prefix and delimiter set to '/'. (62)
|
||||||
|
{"test-bucket-list-object", "/", "", "/", 10, resultCases[30], nil, true},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, testCase := range testCases {
|
for i, testCase := range testCases {
|
||||||
|
@ -114,6 +114,14 @@ func (xl xlObjects) ListObjects(bucket, prefix, marker, delimiter string, maxKey
|
|||||||
return ListObjectsInfo{}, nil
|
return ListObjectsInfo{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For delimiter and prefix as '/' we do not list anything at all
|
||||||
|
// since according to s3 spec we stop at the 'delimiter' along
|
||||||
|
// with the prefix. On a flat namespace with 'prefix' as '/'
|
||||||
|
// we don't have any entries, since all the keys are of form 'keyName/...'
|
||||||
|
if delimiter == slashSeparator && prefix == slashSeparator {
|
||||||
|
return ListObjectsInfo{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Over flowing count - reset to maxObjectList.
|
// Over flowing count - reset to maxObjectList.
|
||||||
if maxKeys < 0 || maxKeys > maxObjectList {
|
if maxKeys < 0 || maxKeys > maxObjectList {
|
||||||
maxKeys = maxObjectList
|
maxKeys = maxObjectList
|
||||||
|
Loading…
Reference in New Issue
Block a user