作者 yangfu

修改配置

... ... @@ -3,7 +3,7 @@ package aliyun
import "fmt"
var (
OssErrFileFormat = fmt.Errorf("文件格式有错")
OssErrFileFormat = fmt.Errorf("文件格式有错")
)
//创建视频上传凭证
... ...
... ... @@ -47,7 +47,7 @@ func ParseUploadAddress(uploadAddress string) (up UploadAddress, err error) {
}
func validFileExt(rule string, ext string) bool {
if strings.ContainsAny(rule, strings.ToLower(ext)) {
if strings.Contains(rule, strings.ToLower(ext)) {
return true
}
return false
... ...
... ... @@ -77,7 +77,7 @@ func CreateUploadImage(header *protocol.RequestHeader, request *aliyun.CreateUpl
request.FileName = aliyun.DefaultImageFileName
}
if !aliyun.ValidFileExt(aliyun.ImageFileExt, request.FileName) {
return nil, aliyun.OssErrFileFormat
return nil, protocol.NewCustomMessage(1, aliyun.OssErrFileFormat.Error())
}
request.Title = utils.GetFileName(header.AppProject, aliyun.FileImage, request.FileName)
rsp, err = aliyun.CreateUploadImage(client, request)
... ...