Skip to content

Commit

Permalink
Merge pull request #14 from whalechoi/master
Browse files Browse the repository at this point in the history
vmess json Unmarshal str convert fix
  • Loading branch information
whalechoi authored May 16, 2024
2 parents d5aff64 + dcd4fbf commit 0b3f5fb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main/shareurls/vmess/vmess.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ const tagVmess = "vmess"

type String string

func (this *String) UnmarshalJSON(port []byte) error {
*this = String(strings.ReplaceAll(string(port), "\"", ""))
func (this *String) UnmarshalJSON(str []byte) error {
if unquote, err := strconv.Unquote(string(str)); err == nil {
*this = String(unquote)
} else {
s := strings.Trim(string(str), "\"")
s = strings.Replace(s, `\/`, `/`, -1)
*this = String(s)
}
return nil
}

Expand Down

0 comments on commit 0b3f5fb

Please sign in to comment.