@@ -20,7 +20,6 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||
"go.gearno.de/kit/pg"
|
||||
"go.probo.inc/probo/pkg/coredata"
|
||||
@@ -71,11 +70,11 @@ func (s ReportService) GenerateDownloadURL(
|
||||
presignClient := s3.NewPresignClient(s.svc.s3)
|
||||
|
||||
presignedReq, err := presignClient.PresignGetObject(ctx, &s3.GetObjectInput{
|
||||
Bucket: aws.String(s.svc.bucket),
|
||||
Key: aws.String(report.ObjectKey),
|
||||
ResponseCacheControl: aws.String("max-age=3600, public"),
|
||||
ResponseContentType: aws.String(report.MimeType),
|
||||
ResponseContentDisposition: aws.String(fmt.Sprintf("attachment; filename=\"%s\"", report.Filename)),
|
||||
Bucket: new(s.svc.bucket),
|
||||
Key: new(report.ObjectKey),
|
||||
ResponseCacheControl: new("max-age=3600, public"),
|
||||
ResponseContentType: new(report.MimeType),
|
||||
ResponseContentDisposition: new(fmt.Sprintf("attachment; filename=\"%s\"", report.Filename)),
|
||||
}, func(opts *s3.PresignOptions) {
|
||||
opts.Expires = expiresIn
|
||||
})
|
||||
@@ -121,8 +120,8 @@ func (s ReportService) exportPDFData(
|
||||
}
|
||||
|
||||
result, err := s.svc.s3.GetObject(ctx, &s3.GetObjectInput{
|
||||
Bucket: aws.String(s.svc.bucket),
|
||||
Key: aws.String(report.ObjectKey),
|
||||
Bucket: new(s.svc.bucket),
|
||||
Key: new(report.ObjectKey),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot download PDF from S3: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user