This commit is contained in:
jiangyong 2026-03-17 12:16:58 +08:00
parent 43d91bd3d8
commit 593342b848
1 changed files with 9 additions and 3 deletions

View File

@ -4,10 +4,11 @@ import (
"context"
"errors"
"fmt"
"github.com/qiniu/go-sdk/v7/auth/qbox"
"github.com/qiniu/go-sdk/v7/storage"
"os"
"time"
"github.com/qiniu/go-sdk/v7/auth/qbox"
"github.com/qiniu/go-sdk/v7/storage"
)
type QiniuConfig struct {
@ -15,6 +16,7 @@ type QiniuConfig struct {
AK string
SK string
Timeout time.Duration
Https bool
}
type Qiniu struct {
@ -167,7 +169,11 @@ func (s *Qiniu) Url(objectName string, expire time.Duration) string {
return ""
}
domain := "https://" + domains[0].Domain
domain := "http://" + domains[0].Domain
if s.config.Https {
domain = "https://" + domains[0].Domain
}
if expire == 0 {
return storage.MakePublicURLv2(domain, objectName)
} else {