mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-07-04 11:52:34 +08:00
Refactor Base64 validation in isLikelyBase64 function to remove unnecessary suffix check.
This commit is contained in:
@ -33,7 +33,7 @@ func ParsePort(portStr string) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isLikelyBase64(s string) bool {
|
func isLikelyBase64(s string) bool {
|
||||||
if len(s)%4 == 0 && strings.HasSuffix(s, "=") && !strings.Contains(strings.TrimSuffix(s, "="), "=") {
|
if len(s)%4 == 0 && !strings.Contains(strings.TrimSuffix(s, "="), "=") {
|
||||||
s = strings.TrimSuffix(s, "=")
|
s = strings.TrimSuffix(s, "=")
|
||||||
chars := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
chars := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||||
for _, c := range s {
|
for _, c := range s {
|
||||||
|
Reference in New Issue
Block a user