diff --git a/api-compose-object.go b/api-compose-object.go index 59abc02f8..8c12c355c 100644 --- a/api-compose-object.go +++ b/api-compose-object.go @@ -119,7 +119,7 @@ func (opts CopyDestOptions) Marshal(header http.Header) { if opts.ReplaceMetadata { header.Set("x-amz-metadata-directive", replaceDirective) for k, v := range filterCustomMeta(opts.UserMetadata) { - if isAmzHeader(k) || isStandardHeader(k) || isStorageClassHeader(k) || isValidReplicationHeader(k) { + if isAmzHeader(k) || isStandardHeader(k) || isStorageClassHeader(k) || isValidReplicationEncryptionHeader(k) { header.Set(k, v) } else { header.Set("x-amz-meta-"+k, v) diff --git a/api-put-object.go b/api-put-object.go index 2c9e430b4..4dec6040d 100644 --- a/api-put-object.go +++ b/api-put-object.go @@ -212,7 +212,7 @@ func (opts PutObjectOptions) Header() (header http.Header) { } for k, v := range opts.UserMetadata { - if isAmzHeader(k) || isStandardHeader(k) || isStorageClassHeader(k) || isValidReplicationHeader(k) { + if isAmzHeader(k) || isStandardHeader(k) || isStorageClassHeader(k) || isValidReplicationEncryptionHeader(k) { header.Set(k, v) } else { header.Set("x-amz-meta-"+k, v) @@ -230,7 +230,7 @@ func (opts PutObjectOptions) Header() (header http.Header) { // validate() checks if the UserMetadata map has standard headers or and raises an error if so. func (opts PutObjectOptions) validate() (err error) { for k, v := range opts.UserMetadata { - if !httpguts.ValidHeaderFieldName(k) || isStandardHeader(k) || isSSEHeader(k) || isStorageClassHeader(k) || isValidReplicationHeader(k) { + if !httpguts.ValidHeaderFieldName(k) || isStandardHeader(k) || isSSEHeader(k) || isStorageClassHeader(k) || isValidReplicationEncryptionHeader(k) { return errInvalidArgument(k + " unsupported user defined metadata name") } if !httpguts.ValidHeaderFieldValue(v) { diff --git a/utils.go b/utils.go index 8e56e5b42..3e7765c1a 100644 --- a/utils.go +++ b/utils.go @@ -520,8 +520,8 @@ var supportedReplicationHeaders = map[string]bool{ // Must be lower case. } -// isValidReplicationHeader returns true if header is one of valid internal headers -func isValidReplicationHeader(headerKey string) bool { +// isValidReplicationEncryptionHeader returns true if header is one of valid internal headers +func isValidReplicationEncryptionHeader(headerKey string) bool { return supportedReplicationHeaders[strings.ToLower(headerKey)] }