"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
onedrive: add --onedrive-root-folder-id flag #5948
Nick Craig-Wood06ffd4882d2e
diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.goindex 14269f443..8052b33a1 100644--- a/backend/onedrive/onedrive.go+++ b/backend/onedrive/onedrive.go@@ -140,6 +140,15 @@ Note that the chunks will be buffered into memory.`,Help: "The type of the drive (" + driveTypePersonal + " | " + driveTypeBusiness + " | " + driveTypeSharepoint + ").",Default: "",Advanced: true,+ }, {+ Name: "root_folder_id",+ Help: `ID of the root folder.++This isn't normally needed, but in special circumstances you might+know the folder ID that you wish to access but not be able to get+there through a path traversal.+`,+ Advanced: true,}, {Name: "disable_site_permission",Help: `Disable the request for Sites.Read.All permission.@@ -547,6 +556,7 @@ type Options struct {ChunkSize fs.SizeSuffix `config:"chunk_size"`DriveID string `config:"drive_id"`DriveType string `config:"drive_type"`+ RootFolderID string `config:"root_folder_id"`DisableSitePermission bool `config:"disable_site_permission"`ExposeOneNoteFiles bool `config:"expose_onenote_files"`ServerSideAcrossConfigs bool `config:"server_side_across_configs"`@@ -852,15 +862,19 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e})// Get rootID- rootInfo, _, err := f.readMetaDataForPath(ctx, "")- if err != nil {- return nil, fmt.Errorf("failed to get root: %w", err)+ var rootID = opt.RootFolderID+ if rootID == "" {+ rootInfo, _, err := f.readMetaDataForPath(ctx, "")+ if err != nil {+ return nil, fmt.Errorf("failed to get root: %w", err)+ }+ rootID = rootInfo.GetID()}- if rootInfo.GetID() == "" {+ if rootID == "" {return nil, errors.New("failed to get root: ID was empty")}- f.dirCache = dircache.New(root, rootInfo.GetID(), f)+ f.dirCache = dircache.New(root, rootID, f)// Find the current rooterr = f.dirCache.FindRoot(ctx, false)@@ -868,7 +882,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e// Assume it is a filenewRoot, remote := dircache.SplitPath(root)tempF := *f- tempF.dirCache = dircache.New(newRoot, rootInfo.ID, &tempF)+ tempF.dirCache = dircache.New(newRoot, rootID, &tempF)tempF.root = newRoot// Make new Fs which is the parenterr = tempF.dirCache.FindRoot(ctx, false)