refactor: guard timeout on API files (#1726)

This commit is contained in:
Kevin Wan
2022-03-31 21:39:02 +08:00
committed by GitHub
parent 321dc2d410
commit 2b9fc26c38
5 changed files with 44 additions and 31 deletions

View File

@@ -75,6 +75,7 @@ func format(query string, args ...interface{}) (string, error) {
break
}
}
if j > i+1 {
index, err := strconv.Atoi(query[i+1 : j])
if err != nil {
@@ -85,7 +86,7 @@ func format(query string, args ...interface{}) (string, error) {
if index > argIndex {
argIndex = index
}
index--
if index < 0 || numArgs <= index {
return "", fmt.Errorf("error: wrong index %d in sql", index)