mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
fix: commonPrefixes behavior in ListObjectVersions (#10286)
``` $ aws s3api --profile minio --endpoint-url http://localhost:9003 \ list-object-versions --bucket testbucket \ --delimiter / --prefix Veeam/Archive/ { "CommonPrefixes": [ { "Prefix": "Veeam/Archive/003/" } ] } ``` Also add coverage tests similar to ListObjects to catch errors in future, skip these tests in FS mode
This commit is contained in:
@@ -873,6 +873,14 @@ func (s *xlStorage) WalkVersions(volume, dirPath, marker string, recursive bool,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Fast exit track to check if we are listing an object with
|
||||
// a trailing slash, this will avoid to list the object content.
|
||||
if HasSuffix(dirPath, SlashSeparator) {
|
||||
if st, err := os.Stat(pathJoin(volumeDir, dirPath, xlStorageFormatFile)); err == nil && st.Mode().IsRegular() {
|
||||
return nil, errFileNotFound
|
||||
}
|
||||
}
|
||||
|
||||
// buffer channel matches the S3 ListObjects implementation
|
||||
ch = make(chan FileInfoVersions, maxObjectList)
|
||||
go func() {
|
||||
@@ -894,6 +902,8 @@ func (s *xlStorage) WalkVersions(volume, dirPath, marker string, recursive bool,
|
||||
var fiv FileInfoVersions
|
||||
if HasSuffix(walkResult.entry, SlashSeparator) {
|
||||
fiv = FileInfoVersions{
|
||||
Volume: volume,
|
||||
Name: walkResult.entry,
|
||||
Versions: []FileInfo{
|
||||
{
|
||||
Volume: volume,
|
||||
|
||||
Reference in New Issue
Block a user