PutBucket: Case-insensitive validation of x-amz-bucket-object-lock-enabled (#8648)

Fix: case insensitive validation of x-amz-bucket-object-lock-enabled header in PutBucket handler
This commit is contained in:
poornas 2019-12-13 15:51:28 -08:00 committed by kannappanr
parent c3d4c1f584
commit 1cf3e3b7b5

View File

@ -484,13 +484,13 @@ func (api objectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Req
bucket := vars["bucket"]
objectLockEnabled := false
if _, found := r.Header[http.CanonicalHeaderKey("x-amz-bucket-object-lock-enabled")]; found {
if r.Header.Get("x-amz-bucket-object-lock-enabled") != "true" {
if vs, found := r.Header[http.CanonicalHeaderKey("x-amz-bucket-object-lock-enabled")]; found {
v := strings.ToLower(strings.Join(vs, ""))
if v != "true" && v != "false" {
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrInvalidRequest), r.URL, guessIsBrowserReq(r))
return
}
objectLockEnabled = true
objectLockEnabled = v == "true"
}
if s3Error := checkRequestAuthType(ctx, r, policy.CreateBucketAction, bucket, ""); s3Error != ErrNone {