fix:修复
This commit is contained in:
@@ -2,16 +2,17 @@ package file
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func FileBase64ToByte(fileData string) ([]byte, error) {
|
||||
func FileBase64ToByte(fileData string) ([]byte, string, error) {
|
||||
RBase64Point := strings.LastIndex(fileData, ";base64,") + 8
|
||||
fileDataStr := fileData[RBase64Point:]
|
||||
dist, err := base64.StdEncoding.DecodeString(fileDataStr)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, "", err
|
||||
}
|
||||
return dist, nil
|
||||
contentType := http.DetectContentType(dist)
|
||||
return dist, contentType, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user