re Update common.go

pull/4926/head
xqzr 2025-07-23 20:02:47 +08:00 committed by GitHub
parent b192a32149
commit cc027be58a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -358,10 +358,12 @@ func ParseRangeString(str string) (int, int, error) {
return 0, 0, nil return 0, 0, nil
} }
// for range value, like "114-514" // for range value, like "114-514"
var pair []string = strings.SplitN(str, "-", 2) var pair []string
// Process sth like "-114-514" "-1919--810" // Process sth like "-114-514" "-1919--810"
if strings.HasPrefix(str, "-") { if strings.HasPrefix(str, "-") {
pair = splitFromSecondDash(str) pair = splitFromSecondDash(str)
} else {
pair = strings.SplitN(str, "-", 2)
} }
if len(pair) == 2 { if len(pair) == 2 {
left, err := strconv.Atoi(pair[0]) left, err := strconv.Atoi(pair[0])