"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
fix: b2 versionAt read metadata
Davide Bizzarri6163ae7cc79f
diff --git a/backend/b2/b2.go b/backend/b2/b2.goindex 71c3ccb9b..e54d7a439 100644--- a/backend/b2/b2.go+++ b/backend/b2/b2.go@@ -1673,6 +1673,21 @@ func (o *Object) getMetaData(ctx context.Context) (info *api.File, err error) {return o.getMetaDataListing(ctx)}}++ // If using versionAt we need to list the find the correct version.+ if o.fs.opt.VersionAt.IsSet() {+ info, err := o.getMetaDataListing(ctx)+ if err != nil {+ return nil, err+ }++ if info.Action == "hide" {+ // Rerturn object not found error if the current version is deleted.+ return nil, fs.ErrorObjectNotFound+ }+ return info, nil+ }+_, info, err = o.getOrHead(ctx, "HEAD", nil)return info, err}diff --git a/backend/b2/b2_internal_test.go b/backend/b2/b2_internal_test.goindex 168f61233..2579928be 100644--- a/backend/b2/b2_internal_test.go+++ b/backend/b2/b2_internal_test.go@@ -446,14 +446,14 @@ func (f *Fs) InternalTestVersions(t *testing.T) {t.Run("List", func(t *testing.T) {fstest.CheckListing(t, f, test.want)})- // b2 NewObject doesn't work with VersionAt- //t.Run("NewObject", func(t *testing.T) {- // gotObj, gotErr := f.NewObject(ctx, fileName)- // assert.Equal(t, test.wantErr, gotErr)- // if gotErr == nil {- // assert.Equal(t, test.wantSize, gotObj.Size())- // }- //})++ t.Run("NewObject", func(t *testing.T) {+ gotObj, gotErr := f.NewObject(ctx, fileName)+ assert.Equal(t, test.wantErr, gotErr)+ if gotErr == nil {+ assert.Equal(t, test.wantSize, gotObj.Size())+ }+ })})}})