Skip to content

Commit 0f013c2

Browse files
authored
fix userid validation issue (#22)
1 parent b6a619e commit 0f013c2

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

datatype/request/user.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package request
33
import (
44
"github.com/MuShare/pluto/utils/general"
55
"strings"
6-
"unicode"
76
)
87

98
const (
@@ -176,10 +175,7 @@ func validateUserID(userID string) bool {
176175
}
177176
//can only be consisted by digit, letter, '-' or '_'
178177
for _, r := range userID {
179-
if r == '_' || r == '-' {
180-
return true
181-
}
182-
if !unicode.IsDigit(r) && !unicode.IsLetter(r) {
178+
if (r < '0' || r > '9') && (r < 'a' || r > 'z') && (r < 'A' || r > 'Z') && r != '_' && r != '-' {
183179
return false
184180
}
185181
}

0 commit comments

Comments
 (0)