azure: handle encryption headers and azure InvalidMetadata error (#4893)

Previously minio gateway returns invalid bucket name error for invalid
meta data.  This is fixed by returning BadRequest with 'Unsupported
metadata' in response.

Fixes #4891
This commit is contained in:
Bala FA
2017-09-12 16:14:41 -07:00
committed by Dee Koder
parent b9fc4150f6
commit 302fcb3b17
4 changed files with 55 additions and 8 deletions

View File

@@ -117,6 +117,7 @@ const (
ErrNotSupported
ErrBucketAlreadyExists
ErrMetadataTooLarge
ErrUnsupportedMetadata
// Add new error codes here.
// Bucket notification related errors.
@@ -654,6 +655,11 @@ var errorCodeResponse = map[APIErrorCode]APIError{
Description: "Your metadata headers exceed the maximum allowed metadata size.",
HTTPStatusCode: http.StatusBadRequest,
},
ErrUnsupportedMetadata: {
Code: "InvalidArgument",
Description: "Your metadata headers are not supported.",
HTTPStatusCode: http.StatusBadRequest,
},
// Add your error structure here.
}
@@ -750,6 +756,8 @@ func toAPIErrorCode(err error) (apiErr APIErrorCode) {
apiErr = ErrNoSuchBucketPolicy
case PartTooBig:
apiErr = ErrEntityTooLarge
case UnsupportedMetadata:
apiErr = ErrUnsupportedMetadata
default:
apiErr = ErrInternalError
}