Skip to content

Commit

Permalink
fix config unexpected end of JSON input
Browse files Browse the repository at this point in the history
  • Loading branch information
LazuliKao committed May 2, 2024
1 parent 44e8552 commit 96c6f3b
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions nbtverify/utils/utils.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package utils

import (
"fmt"
urllib "net/url"
"os"
"strings"
Expand Down Expand Up @@ -63,26 +64,29 @@ func ChangeUrlPath(url string, path string) (string, error) {

func RemoveComments(bytes []byte) []byte {
var result []byte
l := len(bytes) - 1
for i := 0; i < l; i++ {
length := len(bytes)
for i := 0; i < length; i++ {
if bytes[i] == '/' {
if bytes[i+1] == '/' {
i++
for i < l && bytes[i+1] != '\n' {
if i < length-1 {
if bytes[i+1] == '/' {
i++
}
continue
} else if bytes[i+1] == '*' {
i += 2
for i < l && bytes[i] != '*' && bytes[i+1] != '/' {
for i < length-1 && bytes[i+1] != '\n' {
i++
}
continue
} else if bytes[i+1] == '*' {
i += 2
for i < length-1 && bytes[i] != '*' && bytes[i+1] != '/' {
i++
}
i++
continue
}
i++
continue
}
}
result = append(result, bytes[i])
}
fmt.Println(string(result))
return result
}
func FileNotExists(path string) error {
Expand Down

0 comments on commit 96c6f3b

Please # to comment.