'可访问url生成bug修复'

This commit is contained in:
coward
2021-03-13 22:18:18 +08:00
parent 08cb241690
commit ae0b08583a
4 changed files with 17 additions and 8 deletions

View File

@@ -72,10 +72,9 @@ func (ossFile *OssFile) FileTypeTransForm() (*OssFile,error) {
default:
fmt.Println(reflect.TypeOf(ossFile.File))
panic("file type error" )
panic("file type is not support" )
}
ossFile.GetFileType()
return ossFile,nil

2
go.mod
View File

@@ -4,6 +4,8 @@ go 1.15
require (
github.com/aliyun/aliyun-oss-go-sdk v2.1.5+incompatible
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
github.com/satori/go.uuid v1.2.0
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
)

10
go.sum
View File

@@ -1,7 +1,15 @@
github.com/aliyun/aliyun-oss-go-sdk v1.9.8 h1:BOflvK0Zs/zGmoabyFIzTg5c3kguktWTXEwewwbuba0=
github.com/aliyun/aliyun-oss-go-sdk v2.1.5+incompatible h1:v5yDfjkRY/kOxu05gkh0/D/2wYxbTFCoTr3JqFI0FLE=
github.com/aliyun/aliyun-oss-go-sdk v2.1.5+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA=
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s=
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

View File

@@ -24,7 +24,7 @@ type AliOssConfigInterface interface {
func (coon *AliOssConfig) CheckConfig() {
//check endPoint
if coon.EndPoint == "" || len(coon.EndPoint) <= 0 {
panic("endPoint value can not empty")
panic("endPoint value can't empty")
}
//check endPoint http prefix if empty default http
@@ -34,17 +34,17 @@ func (coon *AliOssConfig) CheckConfig() {
//check access secret
if coon.AccessKeyId == "" || len(coon.AccessKeyId) <= 0 {
panic("accessKeyId can not empty")
panic("accessKeyId can't empty")
}
//check access key
if coon.AccessKeySecret == "" || len(coon.AccessKeySecret) <= 0 {
panic("accessKeySecret can not empty")
panic("accessKeySecret can't empty")
}
//check bucket name
if coon.BucketName == "" || len(coon.BucketName) <= 0 {
panic("bucketName can not empty")
panic("bucketName can't empty")
}
}
@@ -105,7 +105,7 @@ func (coon *AliOssConfig) GetAccessibleUrl() string {
//not exists
} else {
//judge domain is http prefix and https prefix
if strings.HasPrefix("http://",coon.Domain) == false && strings.HasPrefix("https://",coon.Domain) == false {
if strings.HasPrefix(coon.Domain,"http://") == false && strings.HasPrefix(coon.Domain,"https://") == false {
domain = endPointUriPrefix + "://" + coon.Domain
} else {
domain = coon.Domain