Skip to content
Snippets Groups Projects
Commit 9b254d09 authored by James Page's avatar James Page
Browse files

#26 Remove ExpiryDuration and UploadWith1DayExpiry

parent 9b3427d8
No related branches found
No related tags found
1 merge request!29Resolve "Remove ExpiryDuration from S3UploadSettings"
......@@ -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{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment