|
|
@@ -458,16 +458,19 @@ func deleteModelByID(ctx *context.Context, id string) error { |
|
|
|
return errors.New(ctx.Tr("repo.model_noright")) |
|
|
|
} |
|
|
|
if err == nil { |
|
|
|
log.Info("bucket=" + setting.Bucket + " path=" + model.Path) |
|
|
|
|
|
|
|
if model.Type == models.TypeCloudBrainOne { |
|
|
|
if strings.HasPrefix(model.Path, setting.Bucket+"/"+Model_prefix) { |
|
|
|
err := storage.Attachments.DeleteDir(model.Path[len(setting.Bucket)+1:]) |
|
|
|
bucketName := setting.Attachment.Minio.Bucket |
|
|
|
log.Info("bucket=" + bucketName + " path=" + model.Path) |
|
|
|
if strings.HasPrefix(model.Path, bucketName+"/"+Model_prefix) { |
|
|
|
err := storage.Attachments.DeleteDir(model.Path[len(bucketName)+1:]) |
|
|
|
if err != nil { |
|
|
|
log.Info("Failed to delete model. id=" + id) |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
} else if model.Type == models.TypeCloudBrainTwo { |
|
|
|
log.Info("bucket=" + setting.Bucket + " path=" + model.Path) |
|
|
|
if strings.HasPrefix(model.Path, setting.Bucket+"/"+Model_prefix) { |
|
|
|
err := storage.ObsRemoveObject(setting.Bucket, model.Path[len(setting.Bucket)+1:]) |
|
|
|
if err != nil { |
|
|
|