Compare commits

...

4 Commits

Author SHA1 Message Date
namhq1989 e857841b95 add repo private chat 2023-03-22 16:13:11 +07:00
namhq1989 e5f266c54a fix content type for video 2023-01-12 17:09:29 +07:00
namhq1989 e9f71ff23c fix content type for video 2023-01-12 16:49:05 +07:00
namhq1989 a2b1b1263b fix content type for video 2023-01-12 16:42:55 +07:00
2 changed files with 9 additions and 6 deletions

View File

@ -3,8 +3,10 @@ package minio
var region = "ap-southeast-1"
var Buckets = struct {
Chat string
HelpCenter string
}{
Chat: "private-chat",
HelpCenter: "help-center",
}
@ -13,7 +15,11 @@ var listBuckets = []string{
}
var ListTypes = struct {
File string
Photo string
Video string
}{
File: "file",
Photo: "photo",
Video: "video",
}

View File

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"net/url"
"strings"
"time"
)
@ -16,12 +15,10 @@ func (c Client) GetPresignedURL(ctx context.Context, bucket, object, fileType st
// params
reqParams := make(url.Values)
reqParams.Set("response-content-disposition", fmt.Sprintf("attachment; filename=\"%s\"", object))
// add content type for video
if fileType == ListTypes.Video {
parts := strings.Split(object, ".")
reqParams.Set("response-content-type", fmt.Sprintf("video/%s", parts[len(parts)-1]))
// set name for type "file"
if fileType == ListTypes.File {
reqParams.Set("response-content-disposition", fmt.Sprintf("attachment; filename=\"%s\"", object))
}
// get