From c13bb6736062cd1fe7a8570b240c3516800cf844 Mon Sep 17 00:00:00 2001 From: CaIon Date: Sun, 12 Oct 2025 12:25:11 +0800 Subject: [PATCH] fix: mask sensitive information in error messages and refine task retrieval query --- model/task.go | 2 +- service/error.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/model/task.go b/model/task.go index 7bd1b9bc4..d02be8ede 100644 --- a/model/task.go +++ b/model/task.go @@ -192,7 +192,7 @@ func GetAllUnFinishSyncTasks(limit int) []*Task { var tasks []*Task var err error // get all tasks progress is not 100% - err = DB.Where("progress != ?", "100%").Limit(limit).Order("id").Find(&tasks).Error + err = DB.Where("progress != ?", "100%").Where("status != ?", TaskStatusFailure).Where("status != ?", TaskStatusSuccess).Limit(limit).Order("id").Find(&tasks).Error if err != nil { return nil } diff --git a/service/error.go b/service/error.go index 2cfd9aba0..070335ec6 100644 --- a/service/error.go +++ b/service/error.go @@ -142,7 +142,8 @@ func TaskErrorWrapper(err error, code string, statusCode int) *dto.TaskError { lowerText := strings.ToLower(text) if strings.Contains(lowerText, "post") || strings.Contains(lowerText, "dial") || strings.Contains(lowerText, "http") { common.SysLog(fmt.Sprintf("error: %s", text)) - text = "请求上游地址失败" + //text = "请求上游地址失败" + text = common.MaskSensitiveInfo(text) } //避免暴露内部错误 taskError := &dto.TaskError{