diff --git a/modules/storage/obs.go b/modules/storage/obs.go index c80b9612f..86f98590d 100755 --- a/modules/storage/obs.go +++ b/modules/storage/obs.go @@ -16,6 +16,7 @@ import ( ) //check if has the object +//todo:修改查询方式 func ObsHasObject(path string) (bool, error) { hasObject := false output, err := ObsCli.ListObjects(&obs.ListObjectsInput{Bucket:setting.Bucket}) @@ -25,6 +26,7 @@ func ObsHasObject(path string) (bool, error) { } for _, obj := range output.Contents { + //obj.Key:attachment/0/1/019fd24e-4ef7-41cc-9f85-4a7b8504d958 if path == obj.Key { hasObject = true break diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 2be78a2e0..77b6fff85 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -292,7 +292,7 @@ func AddAttachment(ctx *context.Context) { return } } else { - has, err = storage.ObsHasObject(models.AttachmentRelativePath(uuid)) + has, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(uuid)) if err != nil { ctx.ServerError("ObsHasObject", err) return diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index cf12eaece..40b985110 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -49,9 +49,8 @@ func ModelArtsIndex(ctx *context.Context) { return } - timestamp := time.Now().Unix() for i, task := range ciTasks { - if task.Status == string(models.JobRunning) && (timestamp-int64(task.CreatedUnix) > 30) { + if task.Status == string(models.JobRunning) { ciTasks[i].CanDebug = true } else { ciTasks[i].CanDebug = false