mirror of
https://github.com/nitezs/sub2sing-box.git
synced 2024-12-23 21:44:41 -05:00
add: url safe base64
This commit is contained in:
parent
7f4ee70cb7
commit
7a5325187a
@ -7,6 +7,11 @@ import (
|
||||
|
||||
func DecodeBase64(s string) (string, error) {
|
||||
s = strings.TrimSpace(s)
|
||||
// url safe
|
||||
if strings.Contains(s, "-") || strings.Contains(s, "_") {
|
||||
s = strings.Replace(s, "-", "+", -1)
|
||||
s = strings.Replace(s, "_", "/", -1)
|
||||
}
|
||||
if len(s)%4 != 0 {
|
||||
s += strings.Repeat("=", 4-len(s)%4)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user