Always get actual size in CopyObjectPart (#12466)

Always use `GetActualSize` to get the part size, not just when encrypted.

Fixes mint test io.minio.MinioClient.uploadPartCopy, 
error "Range specified is not valid for source object".
This commit is contained in:
Klaus Post 2021-06-08 18:51:55 +02:00 committed by GitHub
parent 1bf80a6eea
commit 9a2102f5ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2330,14 +2330,11 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt
defer gr.Close() defer gr.Close()
srcInfo := gr.ObjInfo srcInfo := gr.ObjInfo
actualPartSize := srcInfo.Size actualPartSize, err := srcInfo.GetActualSize()
if _, ok := crypto.IsEncrypted(srcInfo.UserDefined); ok {
actualPartSize, err = srcInfo.GetActualSize()
if err != nil { if err != nil {
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r)) writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r))
return return
} }
}
if err := enforceBucketQuota(ctx, dstBucket, actualPartSize); err != nil { if err := enforceBucketQuota(ctx, dstBucket, actualPartSize); err != nil {
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r)) writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r))