fix(link): decode share link remarks once (#6977)

url.Parse already unescapes the fragment, and decodeHash unescaped it again, so a + in a vless, trojan, hysteria2 or wireguard remark became a space and an escaped % was decoded twice. These parsers now pass the escaped fragment, decoding it once like the shadowsocks parser and the frontend.
This commit is contained in:
Jay Hemnani
2026-11-02 19:43:54 +05:30
committed by GitHub
parent 4cc742bf6f
commit 4180899f15
2 changed files with 35 additions and 4 deletions
+4 -4
View File
@@ -387,7 +387,7 @@ func parseVless(link string) (*ParseResult, error) {
ob := Outbound{
"protocol": "vless",
"tag": decodeHash(u.Fragment),
"tag": decodeHash(u.EscapedFragment()),
"settings": map[string]any{
"address": host,
"port": port,
@@ -429,7 +429,7 @@ func parseTrojan(link string) (*ParseResult, error) {
ob := Outbound{
"protocol": "trojan",
"tag": decodeHash(u.Fragment),
"tag": decodeHash(u.EscapedFragment()),
"settings": map[string]any{
"servers": []any{
map[string]any{"address": host, "port": port, "password": pw},
@@ -634,7 +634,7 @@ func parseHysteria2(link string) (*ParseResult, error) {
ob := Outbound{
"protocol": "hysteria",
"tag": decodeHash(u.Fragment),
"tag": decodeHash(u.EscapedFragment()),
"settings": map[string]any{"address": host, "port": port, "version": 2},
"streamSettings": stream,
}
@@ -712,7 +712,7 @@ func parseWireguard(link string) (*ParseResult, error) {
ob := Outbound{
"protocol": "wireguard",
"tag": decodeHash(u.Fragment),
"tag": decodeHash(u.EscapedFragment()),
"settings": settings,
}
return &ParseResult{Outbound: ob, Identity: identity}, nil