[SSE-C]: avoid encrypting empty objects. (#5525)

This change adds an object size check such that the server does not
encrypt empty objects (typically folders) for SSE-C. The server still
returns SSE-C headers but the object is not encrypted since there is no
point to encrypt such objects.

Fixes #5493
This commit is contained in:
Andreas Auernhammer 2018-02-14 00:43:46 +01:00 committed by kannappanr
parent 91101b11bb
commit 4ca10479b5

View File

@ -556,7 +556,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
return
}
if objectAPI.IsEncryptionSupported() {
if IsSSECustomerRequest(r.Header) { // handle SSE-C requests
if IsSSECustomerRequest(r.Header) && size > 0 { // handle SSE-C requests
reader, err = EncryptRequest(hashReader, r, metadata)
if err != nil {
writeErrorResponse(w, toAPIErrorCode(err), r.URL)