diff --git a/models/attachment.go b/models/attachment.go index 96594bbb3..d217a61a4 100755 --- a/models/attachment.go +++ b/models/attachment.go @@ -379,7 +379,7 @@ func GetUnDecompressAttachments() ([]*Attachment, error) { func getUnDecompressAttachments(e Engine) ([]*Attachment, error) { attachments := make([]*Attachment, 0, 10) - return attachments, e.Where("decompress_state = ? and dataset_id != 0 and attachment.type = ? and (name like '%.zip' or name like '%.tar.gz' or name like '%.tgz')", DecompressStateInit, TypeCloudBrainOne).Find(&attachments) + return attachments, e.Where("decompress_state = ? and dataset_id != 0 and (name like '%.zip' or name like '%.tar.gz' or name like '%.tgz')", DecompressStateInit).Find(&attachments) } func GetAllPublicAttachments() ([]*AttachmentUsername, error) { diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index b6661433e..5bfc4f9a2 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -917,16 +917,22 @@ func HandleUnDecompressAttachment() { } for _, attach := range attachs { - err = worker.SendDecompressTask(contexExt.Background(), attach.UUID, attach.Name) - if err != nil { - log.Error("SendDecompressTask(%s) failed:%s", attach.UUID, err.Error()) - } else { - attach.DecompressState = models.DecompressStateIng - err = models.UpdateAttachment(attach) + if attach.Type == models.TypeCloudBrainOne { + err = worker.SendDecompressTask(contexExt.Background(), attach.UUID, attach.Name) if err != nil { - log.Error("UpdateAttachment state(%s) failed:%s", attach.UUID, err.Error()) + log.Error("SendDecompressTask(%s) failed:%s", attach.UUID, err.Error()) + } else { + attach.DecompressState = models.DecompressStateIng + err = models.UpdateAttachment(attach) + if err != nil { + log.Error("UpdateAttachment state(%s) failed:%s", attach.UUID, err.Error()) + } } + } else if attach.Type == models.TypeCloudBrainTwo { + attachjson, _ := json.Marshal(attach) + labelmsg.SendDecompressAttachToLabelOBS(string(attachjson)) } + } return