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:
@@ -100,19 +100,11 @@ func (manager mcClientManager) getTargetWriter(targetURL string, targetConfig *h
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, iodine.New(err, nil)
|
return nil, iodine.New(err, nil)
|
||||||
}
|
}
|
||||||
// check if bucket is valid, if not create it on target
|
// check if the bucket is valid
|
||||||
// For object storage URL's do a StatBucket() and PutBucket(), not necessary for fs client
|
// For object storage URL's do a StatBucket(), not necessary for fs client
|
||||||
if client.GetType(targetURL) != client.Filesystem {
|
if client.GetType(targetURL) != client.Filesystem {
|
||||||
if err := targetClnt.Stat(); err != nil {
|
if err := targetClnt.Stat(); err != nil {
|
||||||
switch iodine.ToError(err).(type) {
|
return nil, iodine.New(err, map[string]string{"failedURL": targetURL})
|
||||||
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)
|
return targetClnt.Put(md5Hex, length)
|
||||||
|
|||||||
Reference in New Issue
Block a user