Skip to content

Commit

Permalink
⏪ Revert improve ID format validation siyuan-note/siyuan#12824
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Oct 20, 2024
1 parent a6a8f39 commit 9028c98
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 33 deletions.
35 changes: 4 additions & 31 deletions ast/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"bytes"
"math/rand"
"sort"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -183,36 +182,10 @@ func IsNodeIDPattern(str string) bool {
return false
}

// 检查时间部分的范围是否正确,年份为 0000-9999,月份为 01-12,日期为 01-31,小时为 00-23,分钟为 00-59,秒为 00-59
year, month, day, hour, minute, second := idPart[:4], idPart[4:6], idPart[6:8], idPart[8:10], idPart[10:12], idPart[12:14]
yearInt, err := strconv.Atoi(year)
if err != nil || yearInt < 0 || yearInt > 9999 {
return false
}

monthInt, err := strconv.Atoi(month)
if err != nil || monthInt < 1 || monthInt > 12 {
return false
}

dayInt, err := strconv.Atoi(day)
if err != nil || dayInt < 1 || dayInt > 31 {
return false
}

hourInt, err := strconv.Atoi(hour)
if err != nil || hourInt < 0 || hourInt > 23 {
return false
}

minuteInt, err := strconv.Atoi(minute)
if err != nil || minuteInt < 0 || minuteInt > 59 {
return false
}

secondInt, err := strconv.Atoi(second)
if err != nil || secondInt < 0 || secondInt > 59 {
return false
for _, c := range idPart {
if !('0' <= c && '9' >= c) {
return false
}
}

randPart := parts[1]
Expand Down
2 changes: 1 addition & 1 deletion javascript/lute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion javascript/lute.min.js.map

Large diffs are not rendered by default.

0 comments on commit 9028c98

Please sign in to comment.