Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
|
e857841b95 | |
|
e5f266c54a | |
|
e9f71ff23c | |
|
a2b1b1263b |
|
@ -3,8 +3,10 @@ package minio
|
||||||
var region = "ap-southeast-1"
|
var region = "ap-southeast-1"
|
||||||
|
|
||||||
var Buckets = struct {
|
var Buckets = struct {
|
||||||
|
Chat string
|
||||||
HelpCenter string
|
HelpCenter string
|
||||||
}{
|
}{
|
||||||
|
Chat: "private-chat",
|
||||||
HelpCenter: "help-center",
|
HelpCenter: "help-center",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +15,11 @@ var listBuckets = []string{
|
||||||
}
|
}
|
||||||
|
|
||||||
var ListTypes = struct {
|
var ListTypes = struct {
|
||||||
|
File string
|
||||||
|
Photo string
|
||||||
Video string
|
Video string
|
||||||
}{
|
}{
|
||||||
|
File: "file",
|
||||||
|
Photo: "photo",
|
||||||
Video: "video",
|
Video: "video",
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -16,12 +15,10 @@ func (c Client) GetPresignedURL(ctx context.Context, bucket, object, fileType st
|
||||||
|
|
||||||
// params
|
// params
|
||||||
reqParams := make(url.Values)
|
reqParams := make(url.Values)
|
||||||
reqParams.Set("response-content-disposition", fmt.Sprintf("attachment; filename=\"%s\"", object))
|
|
||||||
|
|
||||||
// add content type for video
|
// set name for type "file"
|
||||||
if fileType == ListTypes.Video {
|
if fileType == ListTypes.File {
|
||||||
parts := strings.Split(object, ".")
|
reqParams.Set("response-content-disposition", fmt.Sprintf("attachment; filename=\"%s\"", object))
|
||||||
reqParams.Set("response-content-type", fmt.Sprintf("video/%s", parts[len(parts)-1]))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get
|
// get
|
||||||
|
|
Loading…
Reference in New Issue