1
0
mirror of https://github.com/minio/mc.git synced 2025-11-13 12:22:45 +03:00

Just Stat() the bucket on targets, buckets should be created through ./mc mb

This commit is contained in:
Harshavardhana
2015-04-23 12:20:59 -07:00
parent 4e53814cc3
commit c8ca983373

View File

@@ -100,20 +100,12 @@ func (manager mcClientManager) getTargetWriter(targetURL string, targetConfig *h
if err != nil {
return nil, iodine.New(err, nil)
}
// check if bucket is valid, if not create it on target
// For object storage URL's do a StatBucket() and PutBucket(), not necessary for fs client
// check if the bucket is valid
// For object storage URL's do a StatBucket(), not necessary for fs client
if client.GetType(targetURL) != client.Filesystem {
if err := targetClnt.Stat(); err != nil {
switch iodine.ToError(err).(type) {
case s3.BucketNotFound:
err := targetClnt.PutBucket("")
if err != nil {
return nil, iodine.New(err, map[string]string{"failedURL": targetURL})
}
default:
return nil, iodine.New(err, map[string]string{"failedURL": targetURL})
}
}
}
return targetClnt.Put(md5Hex, length)
}