Check for bucket existence in Set/Get/Remove bucket policy workflow + tests (#2745)

This commit is contained in:
Anis Elleuch
2016-09-22 00:38:50 +01:00
committed by Harshavardhana
parent e66fb4bd7b
commit 90417d2dd6
3 changed files with 99 additions and 9 deletions
+12
View File
@@ -240,3 +240,15 @@ func cleanupDir(storage StorageAPI, volume, dirPath string) error {
err := delFunc(retainSlash(pathJoin(dirPath)))
return err
}
// Checks whether bucket exists.
func isBucketExist(bucket string, obj ObjectLayer) error {
if !IsValidBucketName(bucket) {
return BucketNameInvalid{Bucket: bucket}
}
_, err := obj.GetBucketInfo(bucket)
if err != nil {
return BucketNotFound{Bucket: bucket}
}
return nil
}