Compare commits

...

5 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
namhq1989 f8db798af6 fix content type for video 2023-01-12 16:26:22 +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 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",
} }

View File

@ -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, ".")[1] 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