From d9d2ea41c0cd6f69949b413b809da900bf2a4692 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Wed, 1 Feb 2023 08:50:26 +0800 Subject: [PATCH] fix: Converter Shadowsocks password parse --- common/convert/converter.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/convert/converter.go b/common/convert/converter.go index d58e0bab..df0d9ffd 100644 --- a/common/convert/converter.go +++ b/common/convert/converter.go @@ -2,6 +2,7 @@ package convert import ( "bytes" + "encoding/base64" "encoding/json" "fmt" "github.com/Dreamacro/clash/log" @@ -283,14 +284,17 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) { ) cipher = cipherRaw if password, found = urlSS.User.Password(); !found { - dcBuf, _ := enc.DecodeString(cipherRaw) + dcBuf, err := base64.RawURLEncoding.DecodeString(cipherRaw) + if err != nil { + dcBuf, _ = enc.DecodeString(cipherRaw) + } cipher, password, found = strings.Cut(string(dcBuf), ":") if !found { continue } - err := VerifyMethod(cipher, password) + err = VerifyMethod(cipher, password) if err != nil { - dcBuf, _ := encRaw.DecodeString(cipherRaw) + dcBuf, _ = encRaw.DecodeString(cipherRaw) cipher, password, found = strings.Cut(string(dcBuf), ":") } }