"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: fix nil pointer exception when using Versions
Nick Craig-Wood450c36640350
diff --git a/backend/s3/s3.go b/backend/s3/s3.goindex 8b0b19ee3..36b6a9e61 100644--- a/backend/s3/s3.go+++ b/backend/s3/s3.go@@ -3057,6 +3057,17 @@ func (f *Fs) getMetaDataListing(ctx context.Context, wantRemote string) (info *sreturn info, versionID, nil}+// stringClonePointer clones the string pointed to by sp into new+// memory. This is useful to stop us keeping references to small+// strings carved out of large XML responses.+func stringClonePointer(sp *string) *string {+ if sp == nil {+ return nil+ }+ var s = *sp+ return &s+}+// Return an Object from a path//// If it can't be found it returns the error ErrorObjectNotFound.@@ -3082,8 +3093,7 @@ func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *s3.Obje}o.setMD5FromEtag(aws.StringValue(info.ETag))o.bytes = aws.Int64Value(info.Size)- storageClass := *info.StorageClass // To prevent reference to large XML structures- o.storageClass = &storageClass+ o.storageClass = stringClonePointer(info.StorageClass)o.versionID = versionID} else if !o.fs.opt.NoHeadObject {err := o.readMetaData(ctx) // reads info and meta, returning an error