Add bucketName checks for azure and s3 gateway in GetBucketInfo. (#4992)

Gateway interface implementations of GetBucketInfo() under
azure and s3 gateway did not perform any bucketname input
validation resulting in incorrect responses when the tests
are expecting InvalidBucketName.

Fixes #4983
This commit is contained in:
Harshavardhana
2017-09-28 19:37:09 -07:00
committed by Dee Koder
parent 4c9fae90ff
commit b415c600e1
4 changed files with 29 additions and 1 deletions

View File

@@ -327,6 +327,14 @@ func (a *azureObjects) MakeBucketWithLocation(bucket, location string) error {
// GetBucketInfo - Get bucket metadata..
func (a *azureObjects) GetBucketInfo(bucket string) (bi BucketInfo, e error) {
// Verify if bucket (container-name) is valid.
// IsValidBucketName has same restrictions as container names mentioned
// in azure documentation, so we will simply use the same function here.
// Ref - https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata
if !IsValidBucketName(bucket) {
return bi, traceError(BucketNameInvalid{Bucket: bucket})
}
// Azure does not have an equivalent call, hence use
// ListContainers with prefix
resp, err := a.client.ListContainers(storage.ListContainersParameters{