@ -392,15 +392,6 @@ func (fs fsObjects) PutObject(bucket string, object string, size int64, data io.
limitDataReader = data
}
if size == 0 {
// For size 0 we write a 0byte file.
err = fs . storage . AppendFile ( minioMetaTmpBucket , tempObj , [ ] byte ( "" ) )
if err != nil {
fs . storage . DeleteFile ( minioMetaTmpBucket , tempObj )
return ObjectInfo { } , toObjectErr ( traceError ( err ) , bucket , object )
}
} else {
// Prepare file to avoid disk fragmentation
if size > 0 {
err = fs . storage . PrepareFile ( minioMetaTmpBucket , tempObj , size )
@ -414,6 +405,7 @@ func (fs fsObjects) PutObject(bucket string, object string, size int64, data io.
if size > 0 && bufSize > size {
bufSize = size
}
buf := make ( [ ] byte , int ( bufSize ) )
teeReader := io . TeeReader ( limitDataReader , multiWriter )
var bytesWritten int64
@ -430,7 +422,7 @@ func (fs fsObjects) PutObject(bucket string, object string, size int64, data io.
fs . storage . DeleteFile ( minioMetaTmpBucket , tempObj )
return ObjectInfo { } , traceError ( IncompleteBody { } )
}
}
// Delete the temporary object in the case of a
// failure. If PutObject succeeds, then there would be
// nothing to delete.