fix content type for video
This commit is contained in:
parent
e9f71ff23c
commit
e5f266c54a
|
@ -13,7 +13,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",
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package minio
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -13,21 +14,18 @@ func (c Client) GetPresignedURL(ctx context.Context, bucket, object, fileType st
|
||||||
}
|
}
|
||||||
|
|
||||||
// params
|
// params
|
||||||
//reqParams := make(url.Values)
|
reqParams := make(url.Values)
|
||||||
//
|
|
||||||
//// 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]))
|
}
|
||||||
//} else {
|
|
||||||
// reqParams.Set("response-content-disposition", fmt.Sprintf("attachment; filename=\"%s\"", object))
|
|
||||||
//}
|
|
||||||
|
|
||||||
// get
|
// get
|
||||||
presignedURL, err := c.client.PresignedGetObject(ctx, bucket, object, expiry, nil)
|
presignedURL, err := c.client.PresignedGetObject(ctx, bucket, object, expiry, reqParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("[minio.GetPresignedURL][%s] get object '%s' error: %s \n", bucket, object, err.Error())
|
fmt.Printf("[minio.GetPresignedURL][%s] get object '%s' error: %s \n", bucket, object, err.Error())
|
||||||
//fmt.Printf("params %v \n", reqParams)
|
fmt.Printf("params %v \n", reqParams)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue