Commit e63c626b authored by duanjinfei's avatar duanjinfei

update check base64

parent 9535edc2
......@@ -116,7 +116,15 @@ func IsBase64ImageStr(imageStr string) (bool, []byte, string, string) {
log.WithError(err).Error("base64 decode string failed")
return false, nil, "", ""
}
formatStr := strings.Split(strings.Split(base64CodePrefix, ";")[0], ":")[1]
dataSuffix := strings.Split(base64CodePrefix, ";")
if len(dataSuffix) < 1 {
return false, nil, "", ""
}
formatStrArr := strings.Split(dataSuffix[0], ":")
if len(formatStrArr) < 2 {
return false, nil, "", ""
}
formatStr := formatStrArr[1]
suffix := strings.Split(formatStr, "/")[1]
return true, decodeBytes, formatStr, suffix
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment