mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-26 03:26:57 +08:00
s3 url
This commit is contained in:
parent
84f8074d6a
commit
406a77d5b8
@ -233,14 +233,14 @@ func (c *Cos) ListUploadedParts(ctx context.Context, uploadID string, name strin
|
|||||||
|
|
||||||
func (c *Cos) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) {
|
func (c *Cos) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) {
|
||||||
reqParams := make(url.Values)
|
reqParams := make(url.Values)
|
||||||
if opt != nil {
|
//if opt != nil {
|
||||||
if opt.ContentType != "" {
|
// if opt.ContentType != "" {
|
||||||
reqParams.Set("Content-Type", opt.ContentType)
|
// reqParams.Set("Content-Type", opt.ContentType)
|
||||||
}
|
// }
|
||||||
if opt.ContentDisposition != "" {
|
// if opt.ContentDisposition != "" {
|
||||||
reqParams.Set("Content-Disposition", opt.ContentDisposition)
|
// reqParams.Set("Content-Disposition", opt.ContentDisposition)
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
if expire <= 0 {
|
if expire <= 0 {
|
||||||
expire = time.Hour * 24 * 365 * 99 // 99 years
|
expire = time.Hour * 24 * 365 * 99 // 99 years
|
||||||
} else if expire < time.Second {
|
} else if expire < time.Second {
|
||||||
|
@ -229,14 +229,14 @@ func (m *Minio) ListUploadedParts(ctx context.Context, uploadID string, name str
|
|||||||
|
|
||||||
func (m *Minio) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) {
|
func (m *Minio) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) {
|
||||||
reqParams := make(url.Values)
|
reqParams := make(url.Values)
|
||||||
if opt != nil {
|
//if opt != nil {
|
||||||
if opt.ContentType != "" {
|
// if opt.ContentType != "" {
|
||||||
reqParams.Set("Content-Type", opt.ContentType)
|
// reqParams.Set("Content-Type", opt.ContentType)
|
||||||
}
|
// }
|
||||||
if opt.ContentDisposition != "" {
|
// if opt.ContentDisposition != "" {
|
||||||
reqParams.Set("Content-Disposition", opt.ContentDisposition)
|
// reqParams.Set("Content-Disposition", opt.ContentDisposition)
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
if expire <= 0 {
|
if expire <= 0 {
|
||||||
expire = time.Hour * 24 * 365 * 99 // 99 years
|
expire = time.Hour * 24 * 365 * 99 // 99 years
|
||||||
} else if expire < time.Second {
|
} else if expire < time.Second {
|
||||||
|
@ -242,14 +242,14 @@ func (o *OSS) ListUploadedParts(ctx context.Context, uploadID string, name strin
|
|||||||
|
|
||||||
func (o *OSS) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) {
|
func (o *OSS) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) {
|
||||||
var opts []oss.Option
|
var opts []oss.Option
|
||||||
if opt != nil {
|
//if opt != nil {
|
||||||
if opt.ContentType != "" {
|
// if opt.ContentType != "" {
|
||||||
opts = append(opts, oss.ContentType(opt.ContentType))
|
// opts = append(opts, oss.ContentType(opt.ContentType))
|
||||||
}
|
// }
|
||||||
if opt.ContentDisposition != "" {
|
// if opt.ContentDisposition != "" {
|
||||||
opts = append(opts, oss.ContentDisposition(opt.ContentDisposition))
|
// opts = append(opts, oss.ContentDisposition(opt.ContentDisposition))
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
if expire <= 0 {
|
if expire <= 0 {
|
||||||
expire = time.Hour * 24 * 365 * 99 // 99 years
|
expire = time.Hour * 24 * 365 * 99 // 99 years
|
||||||
} else if expire < time.Second {
|
} else if expire < time.Second {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user