XL non-recursive fix (#1450)

master
karthic rao 9 years ago committed by Harshavardhana
parent d006129fb5
commit 2393a3a0be
  1. 32
      xl-objects.go

@ -296,35 +296,33 @@ func (xl xlObjects) ListObjects(bucket, prefix, marker, delimiter string, maxKey
for _, fileInfo := range fileInfos { for _, fileInfo := range fileInfos {
// FIXME: use fileInfo.Mode.IsDir() instead after fixing the bug in // FIXME: use fileInfo.Mode.IsDir() instead after fixing the bug in
// XL listing which is not reseting the Mode to 0 for leaf dirs. // XL listing which is not reseting the Mode to 0 for leaf dirs.
if strings.HasSuffix(fileInfo.Name, slashSeparator) { if strings.HasSuffix(fileInfo.Name, slashSeparator) && isLeafDirectory(xl.storage, bucket, fileInfo.Name) {
if isLeafDirectory(xl.storage, bucket, fileInfo.Name) { // Set the Mode to a "regular" file.
fileInfo.Name = strings.TrimSuffix(fileInfo.Name, slashSeparator) var info MultipartObjectInfo
// Set the Mode to a "regular" file. info, err = xl.getMultipartObjectInfo(bucket, fileInfo.Name)
if err == nil {
fileInfo.Mode = 0 fileInfo.Mode = 0
var info MultipartObjectInfo
info, err = xl.getMultipartObjectInfo(bucket, fileInfo.Name) fileInfo.Name = strings.TrimSuffix(fileInfo.Name, slashSeparator)
if err != nil {
return ListObjectsInfo{}, toObjectErr(err, bucket)
}
fileInfo.Size = info.GetSize() fileInfo.Size = info.GetSize()
allFileInfos = append(allFileInfos, fileInfo) } else if err != errFileNotFound {
maxKeys-- return ListObjectsInfo{}, toObjectErr(err, bucket, fileInfo.Name)
continue
} }
} allFileInfos = append(allFileInfos, fileInfo)
if strings.HasSuffix(fileInfo.Name, multipartMetaFile) { maxKeys--
continue
} else if strings.HasSuffix(fileInfo.Name, multipartMetaFile) {
fileInfo.Name = path.Dir(fileInfo.Name) fileInfo.Name = path.Dir(fileInfo.Name)
var info MultipartObjectInfo var info MultipartObjectInfo
info, err = xl.getMultipartObjectInfo(bucket, fileInfo.Name) info, err = xl.getMultipartObjectInfo(bucket, fileInfo.Name)
if err != nil { if err != nil {
return ListObjectsInfo{}, toObjectErr(err, bucket) return ListObjectsInfo{}, toObjectErr(err, bucket, fileInfo.Name)
} }
fileInfo.Size = info.GetSize() fileInfo.Size = info.GetSize()
allFileInfos = append(allFileInfos, fileInfo) allFileInfos = append(allFileInfos, fileInfo)
maxKeys-- maxKeys--
continue continue
} } else if strings.HasSuffix(fileInfo.Name, multipartSuffix) {
if strings.HasSuffix(fileInfo.Name, multipartSuffix) {
continue continue
} }
allFileInfos = append(allFileInfos, fileInfo) allFileInfos = append(allFileInfos, fileInfo)

Loading…
Cancel
Save