Fix cleanup of pipe in GetObjectNInfo handlers (#6509)

This commit is contained in:
Aditya Manthramurthy
2018-09-21 11:42:06 -07:00
committed by kannappanr
parent 36e51d0cee
commit 3c8fabd116
9 changed files with 34 additions and 9 deletions

View File

@@ -565,7 +565,10 @@ func (l *ossObjects) GetObjectNInfo(ctx context.Context, bucket, object string,
err := l.GetObject(ctx, bucket, object, startOffset, length, pw, objInfo.ETag, minio.ObjectOptions{})
pw.CloseWithError(err)
}()
return minio.NewGetObjectReaderFromReader(pr, objInfo), nil
// Setup cleanup function to cause the above go-routine to
// exit in case of partial read
pipeCloser := func() { pr.Close() }
return minio.NewGetObjectReaderFromReader(pr, objInfo, pipeCloser), nil
}
// GetObject reads an object on OSS. Supports additional