"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
acd, onedrive: fix initialization order for token renewer - fixes #1442
Nick Craig-Wood70b5b2f5c6b8
diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.goindex bf4f42a71..3b21b5a18 100644--- a/amazonclouddrive/amazonclouddrive.go+++ b/amazonclouddrive/amazonclouddrive.go@@ -192,6 +192,12 @@ func NewFs(name, root string) (fs.Fs, error) {}f.features = (&fs.Features{CaseInsensitive: true, ReadMimeType: true}).Fill(f)+ // Renew the token in the background+ f.tokenRenewer = oauthutil.NewRenew(f.String(), ts, func() error {+ _, err := f.getRootInfo()+ return err+ })+// Update endpointsvar resp *http.Responseerr = f.pacer.Call(func() (bool, error) {@@ -209,12 +215,6 @@ func NewFs(name, root string) (fs.Fs, error) {}f.trueRootID = *rootInfo.Id- // Renew the token in the background- f.tokenRenewer = oauthutil.NewRenew(f.String(), ts, func() error {- _, err := f.getRootInfo()- return err- })-f.dirCache = dircache.New(root, f.trueRootID, f)// Find the current rootdiff --git a/onedrive/onedrive.go b/onedrive/onedrive.goindex edf6da438..c0ae1ea24 100644--- a/onedrive/onedrive.go+++ b/onedrive/onedrive.go@@ -208,18 +208,18 @@ func NewFs(name, root string) (fs.Fs, error) {f.features = (&fs.Features{CaseInsensitive: true, ReadMimeType: true}).Fill(f)f.srv.SetErrorHandler(errorHandler)- // Get rootID- rootInfo, _, err := f.readMetaDataForPath("")- if err != nil || rootInfo.ID == "" {- return nil, errors.Wrap(err, "failed to get root")- }-// Renew the token in the backgroundf.tokenRenewer = oauthutil.NewRenew(f.String(), ts, func() error {_, _, err := f.readMetaDataForPath("")return err})+ // Get rootID+ rootInfo, _, err := f.readMetaDataForPath("")+ if err != nil || rootInfo.ID == "" {+ return nil, errors.Wrap(err, "failed to get root")+ }+f.dirCache = dircache.New(root, rootInfo.ID, f)// Find the current root