Return ETag for 0-byte object prefixes (#7291)

Fixes: #7290
master
poornas 6 years ago committed by Harshavardhana
parent d3125857a8
commit 8022a6efd9
  1. 14
      cmd/fs-v1.go

@ -490,20 +490,18 @@ func (fs *FSObjects) GetObjectNInfo(ctx context.Context, bucket, object string,
} }
} }
// For a directory, we need to send an reader that returns no bytes.
if hasSuffix(object, slashSeparator) {
// The lock taken above is released when
// objReader.Close() is called by the caller.
return NewGetObjectReaderFromReader(bytes.NewBuffer(nil), ObjectInfo{}, nsUnlocker), nil
}
// Otherwise we get the object info // Otherwise we get the object info
var objInfo ObjectInfo var objInfo ObjectInfo
if objInfo, err = fs.getObjectInfo(ctx, bucket, object); err != nil { if objInfo, err = fs.getObjectInfo(ctx, bucket, object); err != nil {
nsUnlocker() nsUnlocker()
return nil, toObjectErr(err, bucket, object) return nil, toObjectErr(err, bucket, object)
} }
// For a directory, we need to send an reader that returns no bytes.
if hasSuffix(object, slashSeparator) {
// The lock taken above is released when
// objReader.Close() is called by the caller.
return NewGetObjectReaderFromReader(bytes.NewBuffer(nil), objInfo, nsUnlocker), nil
}
// Take a rwPool lock for NFS gateway type deployment // Take a rwPool lock for NFS gateway type deployment
rwPoolUnlocker := func() {} rwPoolUnlocker := func() {}
if bucket != minioMetaBucket && lockType != noLock { if bucket != minioMetaBucket && lockType != noLock {

Loading…
Cancel
Save