使用请求ID搜索访问日志时自动去除多余的空格和句号

This commit is contained in:
GoEdgeLab
2021-12-02 14:44:20 +08:00
parent 754fedba20
commit d5e830dd6d

View File

@@ -330,9 +330,9 @@ func (this *HTTPAccessLogDAO) listAccessLogs(tx *dbs.Tx, lastRequestId string, s
query.Param("intKeyword2", types.Int(pieces[1]))
}
if regexp.MustCompile(`^\d{20,}$`).MatchString(keyword) {
if regexp.MustCompile(`^\d{20,}\s*\.?$`).MatchString(keyword) {
where += " OR requestId=:requestId"
query.Param("requestId", keyword)
query.Param("requestId", strings.TrimRight(keyword, ". "))
}
query.Where("("+where+")").