mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 01:45:41 +00:00
fix: mask sensitive information in error messages and refine task retrieval query
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user