Directory HEADs with encryption headers shouldn't return errors (#5539)

Since we do not encrypt directories we don't need to send
errors with encryption headers when the directory doesn't
have encryption metadata.

Continuation PR from 4ca10479b5
master
Harshavardhana 7 years ago committed by kannappanr
parent 22897de4c7
commit dd80256151
  1. 14
      cmd/object-handlers.go

@ -240,7 +240,8 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
writeErrorResponseHeadersOnly(w, apiErr)
return
}
if objectAPI.IsEncryptionSupported() {
if objectAPI.IsEncryptionSupported() && !objInfo.IsDir {
if apiErr, encrypted := DecryptObjectInfo(&objInfo, r.Header); apiErr != ErrNone {
writeErrorResponse(w, apiErr, r.URL)
return
@ -342,17 +343,18 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
return
}
if IsSSECustomerRequest(r.Header) { // handle SSE-C requests
// SSE-C is not implemented for CopyObject operations yet
writeErrorResponse(w, ErrNotImplemented, r.URL)
return
}
// Check if metadata directive is valid.
if !isMetadataDirectiveValid(r.Header) {
writeErrorResponse(w, ErrInvalidMetadataDirective, r.URL)
return
}
if IsSSECustomerRequest(r.Header) { // handle SSE-C requests
// SSE-C is not implemented for CopyObject operations yet
writeErrorResponse(w, ErrNotImplemented, r.URL)
return
}
cpSrcDstSame := srcBucket == dstBucket && srcObject == dstObject
objInfo, err := objectAPI.GetObjectInfo(srcBucket, srcObject)

Loading…
Cancel
Save