XL: return false only if given prefix doesn't exist in all disks (#1877)

Previously xl.isObject() returns false if one of the disk doesn't have
the object.  Its possible that object may be present in another disk.

This patch fixes the issue by returning false only if given prefix
doesn't exist in all disks.

Fixes #1855
master
Bala FA 9 years ago committed by Harshavardhana
parent c5b6cb2420
commit d32f3288f8
  1. 11
      xl-v1-common.go

@ -61,16 +61,19 @@ func (xl xlObjects) isObject(bucket, prefix string) bool {
if disk == nil {
continue
}
// Check if 'prefix' is an object in this 'disk', else continue the check with next disk
_, err := disk.StatFile(bucket, path.Join(prefix, xlMetaJSONFile))
if err != nil {
if err == errDiskNotFound {
if err == errFileNotFound || err == errDiskNotFound {
continue
}
return false
// TODO: log the error
} else {
return true
}
break
}
return true
return false
}
// statPart - returns fileInfo structure for a successful stat on part file.

Loading…
Cancel
Save