Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
LazuliKao committed Nov 12, 2024
1 parent fceb4ef commit 2c6c20f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//输出状态信息json到文件(留空忽略)
"status": "",
//测试连接使用的URL(可留空)
"ping_url": "http://baidu.com",
"ping_url": "http://www.nbt.edu.cn/",
//登录的URL缓存文件
"cache": "url.txt"
}
8 changes: 6 additions & 2 deletions nbtverify/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ func ChangeUrlPath(url string, path string) (string, error) {
func RemoveComments(bytes []byte) []byte {
var result []byte
length := len(bytes)
inString := false
for i := 0; i < length; i++ {
if bytes[i] == '/' {
if bytes[i] == '"' {
inString = !inString
}
if !inString && bytes[i] == '/' {
if i < length-1 {
if bytes[i+1] == '/' {
i++
Expand All @@ -76,7 +80,7 @@ func RemoveComments(bytes []byte) []byte {
continue
} else if bytes[i+1] == '*' {
i += 2
for i < length-1 && bytes[i] != '*' && bytes[i+1] != '/' {
for i < length-1 && !(bytes[i] == '*' && bytes[i+1] == '/') {
i++
}
i++
Expand Down

0 comments on commit 2c6c20f

Please sign in to comment.