diff --git a/service/common/crypto.go b/service/common/crypto.go index b9e5173d..4a067e8a 100644 --- a/service/common/crypto.go +++ b/service/common/crypto.go @@ -44,10 +44,11 @@ func Base64StdDecode(s string) (string, error) { return string(raw), err } -// 封装base64.URLEncoding进行解码,加入了长度补全。当error时,返回输入和err +// 封装base64.URLEncoding进行解码,加入了长度补全,换行删除。当error时,返回输入和err func Base64URLDecode(s string) (string, error) { s = strings.TrimSpace(s) saver := s + s = strings.ReplaceAll(strings.ReplaceAll(s, "\n", ""), "\r", "") if len(s)%4 > 0 { s += strings.Repeat("=", 4-len(s)%4) }