From 09b84c4adff4ba7e0760c6e95a813614a9ae7b8a Mon Sep 17 00:00:00 2001 From: Cornel Rautenbach <corneliusr> Date: Wed, 23 Mar 2022 09:28:12 +0200 Subject: [PATCH] Add should download to UploadWith1DayExpiry --- s3/s3.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/s3/s3.go b/s3/s3.go index 478d1ba..6dfe16d 100644 --- a/s3/s3.go +++ b/s3/s3.go @@ -135,16 +135,17 @@ func (s SessionWithHelpers) UploadWithSettings(data []byte, bucket, fileName str return "", nil } -func (s SessionWithHelpers) UploadWith1DayExpiry(data []byte, bucket, fileName string, mimeType MIMEType) (string, error) { +func (s SessionWithHelpers) UploadWith1DayExpiry(data []byte, bucket, fileName string, mimeType MIMEType, shouldDownloadInsteadOfOpen bool) (string, error) { if mimeType == "" { mimeType = getTypeForFilename(fileName) } expiry := 24 * time.Hour signedUrl, err := s.UploadWithSettings(data, bucket, fileName, S3UploadSettings{ - MimeType: mimeType, - RetrieveSignedUrl: true, - ExpiryDuration: &expiry, + MimeType: mimeType, + RetrieveSignedUrl: true, + ExpiryDuration: &expiry, + AddContentDisposition: shouldDownloadInsteadOfOpen, }) if err != nil { return "", err -- GitLab