"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
s3: Cap expiry duration to 1 Week and return error when sharing dir
Nick Craig-Wood85bcacac905b
diff --git a/backend/s3/s3.go b/backend/s3/s3.goindex d287375c2..9cdc53401 100644--- a/backend/s3/s3.go+++ b/backend/s3/s3.go@@ -965,6 +965,7 @@ const (memoryPoolFlushTime = fs.Duration(time.Minute) // flush the cached buffers after this longmemoryPoolUseMmap = false+ maxExpireDuration = fs.Duration(7 * 24 * time.Hour) // max expiry is 1 week)// Options defines the configuration for this backend@@ -2021,9 +2022,16 @@ func (f *Fs) getMemoryPool(size int64) *pool.Pool {// PublicLink generates a public link to the remote path (usually readable by anyone)func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration, unlink bool) (link string, err error) {+ if strings.HasSuffix(remote, "/") {+ return "", fs.ErrorCantShareDirectories+ }if _, err := f.NewObject(ctx, remote); err != nil {return "", err}+ if expire > maxExpireDuration {+ fs.Logf(f, "Public Link: Reducing expiry to %v as %v is greater than the max time allowed", maxExpireDuration, expire)+ expire = maxExpireDuration+ }bucket, bucketPath := f.split(remote)httpReq, _ := f.c.GetObjectRequest(&s3.GetObjectInput{Bucket: &bucket,