Skip to content

Commit

Permalink
fix: space at the end of base64 string
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Jan 12, 2025
1 parent d4af3ee commit 1134557
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ray2sing/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,15 @@ func getDialerOptions(decoded map[string]string) option.DialerOptions {
}

func decodeBase64IfNeeded(b64string string) (string, error) {
b64string = strings.TrimSpace(b64string)

padding := len(b64string) % 4
b64stringFix := b64string
if padding != 0 {
b64stringFix += string("===="[:4-padding])
}
decodedBytes, err := base64.StdEncoding.DecodeString(b64stringFix)

if err != nil {
return b64string, err
}
Expand Down

0 comments on commit 1134557

Please sign in to comment.