From 9b254d092b4dc9f8e99f8dd30f71d9390ae5dbe0 Mon Sep 17 00:00:00 2001 From: James Page <james@uafrica.com> Date: Mon, 1 Aug 2022 16:00:10 +0200 Subject: [PATCH] #26 Remove ExpiryDuration and UploadWith1DayExpiry --- s3/s3.go | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/s3/s3.go b/s3/s3.go index 2c5eab9..64c319e 100644 --- a/s3/s3.go +++ b/s3/s3.go @@ -112,11 +112,6 @@ func (s SessionWithHelpers) UploadWithSettings(data []byte, bucket, fileName str Body: bytes.NewReader(data), } - if settings.ExpiryDuration != nil { - expiry := time.Now().Add(*settings.ExpiryDuration) - putInput.Expires = &expiry - } - _, err := s.S3Session.PutObject(putInput) if err != nil { return "", err @@ -142,25 +137,6 @@ func (s SessionWithHelpers) UploadWithSettings(data []byte, bucket, fileName str return "", nil } -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, - AddContentDisposition: shouldDownloadInsteadOfOpen, - }) - if err != nil { - return "", err - } - - return signedUrl, nil -} - // GetSignedDownloadURL gets a signed download URL for the duration. If scv is nil, a new session will be created. func (s SessionWithHelpers) GetSignedDownloadURL(bucket string, fileName string, duration time.Duration, headers ...map[string]string) (string, error) { getInput := &s3.GetObjectInput{ -- GitLab