"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
drive: don't delete files with multiple parents to avoid data loss
Nick Craig-Woodff0a299bfb4b
diff --git a/backend/drive/drive.go b/backend/drive/drive.goindex 4007d2056..f47f79d2a 100755--- a/backend/drive/drive.go+++ b/backend/drive/drive.go@@ -551,6 +551,7 @@ type baseObject struct {modifiedDate string // RFC3339 time it was last modifiedmimeType string // The object MIME typebytes int64 // size of the object+ parents int // number of parents}type documentObject struct {baseObject@@ -1176,6 +1177,7 @@ func (f *Fs) newBaseObject(remote string, info *drive.File) baseObject {modifiedDate: modifiedDate,mimeType: info.MimeType,bytes: size,+ parents: len(info.Parents),}}@@ -2989,6 +2991,9 @@ func (o *linkObject) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo// Remove an objectfunc (o *baseObject) Remove(ctx context.Context) error {+ if o.parents > 1 {+ return errors.New("can't delete safely - has multiple parents")+ }var err errorerr = o.fs.pacer.Call(func() (bool, error) {if o.fs.opt.UseTrash {