作者 yangfu

修改配置

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