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