"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: work around drive bug which didn't set modtime of copied docs
Nick Craig-Woodb5ba077a2f78
diff --git a/backend/drive/drive.go b/backend/drive/drive.goindex 02efb3f50..e12953c6e 100755--- a/backend/drive/drive.go+++ b/backend/drive/drive.go@@ -2258,13 +2258,13 @@ func (f *Fs) Precision() time.Duration {func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, error) {var srcObj *baseObjectext := ""- readDescription := false+ isDoc := falseswitch src := src.(type) {case *Object:srcObj = &src.baseObjectcase *documentObject:srcObj, ext = &src.baseObject, src.ext()- readDescription = true+ isDoc = truecase *linkObject:srcObj, ext = &src.baseObject, src.ext()default:@@ -2288,7 +2288,7 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,return nil, err}- if readDescription {+ if isDoc {// preserve the description on copy for docsinfo, err := f.getFile(actualID(srcObj.id), "description")if err != nil {@@ -2320,6 +2320,22 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,if err != nil {return nil, err}+ // Google docs aren't preserving their mod time after copy, so set them explicitly+ // See: https://github.com/rclone/rclone/issues/4517+ //+ // FIXME remove this when google fixes the problem!+ if isDoc {+ // A short sleep is needed here in order to make the+ // change effective, without it is is ignored. This is+ // probably some eventual consistency nastiness.+ sleepTime := 2 * time.Second+ fs.Debugf(f, "Sleeping for %v before setting the modtime to work around drive bug - see #4517")+ time.Sleep(sleepTime)+ err = newObject.SetModTime(ctx, src.ModTime(ctx))+ if err != nil {+ return nil, err+ }+ }if existingObject != nil {err = existingObject.Remove(ctx)if err != nil {