|
|
|
@ -1755,6 +1755,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isEncrypted := false |
|
|
|
|
if objectAPI.IsEncryptionSupported() && !isCompressed { |
|
|
|
|
var li ListPartsInfo |
|
|
|
|
li, err = objectAPI.ListObjectParts(ctx, bucket, object, uploadID, 0, 1) |
|
|
|
@ -1763,7 +1764,8 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if crypto.IsEncrypted(li.UserDefined) { |
|
|
|
|
if !hasServerSideEncryptionHeader(r.Header) { |
|
|
|
|
isEncrypted = true |
|
|
|
|
if !crypto.SSEC.IsRequested(r.Header) && crypto.SSEC.IsEncrypted(li.UserDefined) { |
|
|
|
|
writeErrorResponse(w, ErrSSEMultipartEncrypted, r.URL) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -1791,7 +1793,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http |
|
|
|
|
mac.Write(partIDbin[:]) |
|
|
|
|
partEncryptionKey := mac.Sum(nil) |
|
|
|
|
|
|
|
|
|
reader, err = sio.EncryptReader(reader, sio.Config{Key: partEncryptionKey}) |
|
|
|
|
reader, err = sio.EncryptReader(hashReader, sio.Config{Key: partEncryptionKey}) |
|
|
|
|
if err != nil { |
|
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL) |
|
|
|
|
return |
|
|
|
@ -1807,7 +1809,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
putObjectPart := objectAPI.PutObjectPart |
|
|
|
|
if api.CacheAPI() != nil && !hasServerSideEncryptionHeader(r.Header) { |
|
|
|
|
if api.CacheAPI() != nil && !isEncrypted { |
|
|
|
|
putObjectPart = api.CacheAPI().PutObjectPart |
|
|
|
|
} |
|
|
|
|
partInfo, err := putObjectPart(ctx, bucket, object, uploadID, partID, hashReader, opts) |
|
|
|
|