update gen file url for minio
This commit is contained in:
parent
2dd6d69acf
commit
77c1b63622
@ -4,12 +4,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/minio/minio-go/v7"
|
"github.com/minio/minio-go/v7"
|
||||||
"net/url"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
bucket = "3c580be9-cf31f296-d055-49cf-b39e-30c7959dc17b"
|
bucket = "3c580be9-cf31f296-d055-49cf-b39e-30c7959dc17b"
|
||||||
bucketAnswers = "squizanswer"
|
bucketAnswers = "squizanswer"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,12 +24,7 @@ func NewAnswerMinio(ctx context.Context, minioClient *minio.Client) (*StorerAnsw
|
|||||||
func (s *StorerAnswer) GetAnswerURL(ctx context.Context, quizID string, questionID int64, filename string) (string, error) {
|
func (s *StorerAnswer) GetAnswerURL(ctx context.Context, quizID string, questionID int64, filename string) (string, error) {
|
||||||
objectName := fmt.Sprintf("%s/%d/%s", quizID, questionID, filename)
|
objectName := fmt.Sprintf("%s/%d/%s", quizID, questionID, filename)
|
||||||
|
|
||||||
reqParams := make(url.Values)
|
url := fmt.Sprintf("https://%s/%s/%s", s.client.EndpointURL().Host, bucket, bucketAnswers+"/"+objectName)
|
||||||
reqParams.Set("response-content-disposition", "attachment")
|
|
||||||
url, err := s.client.PresignedGetObject(ctx, bucket, bucketAnswers + "/" + objectName, time.Hour*1, reqParams)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
return url.String(), nil
|
return url, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user