Files
3x-ui/sub/subService.go
MHSanaei 3c5e9fa774 fix(sub): preserve userinfo encoding in trojan/shadowsocks/hysteria links
The link builders ran the assembled share link through url.Parse +
parsedURL.String(), which decodes the userinfo and re-emits it via
Go's lenient encoder — sub-delim chars (=, +, ;) are left literal even
when the caller had pre-encoded them via encodeUserinfo. Result: copy
URL from the panel UI worked (FE never round-trips), but the same
inbound in the subscription body became "trojan://abc%2Fdef=ghi+@..."
and was rejected by Trojan/Hysteria clients.

Replace url.Parse + .String() with a direct string-builder that
appends ?query and #fragment without touching the userinfo, and apply
it to genHysteriaLink's inline copies too. Also switch the
shadowsocks userinfo from base64.StdEncoding (with =/+/ /padding) to
base64.RawURLEncoding to match the frontend's Base64.encode(s, true).
2026-05-27 10:51:41 +02:00

55 KiB