Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

onedrive: add missing drive on config - fixes #4068

Nick Craig-Woodd9c8c47e028a
diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go
index 8ee8f9997..e560fb0b1 100644
--- a/backend/onedrive/onedrive.go
+++ b/backend/onedrive/onedrive.go
@@ -184,6 +184,28 @@ func init() {
log.Fatalf("Failed to query available drives: %v", err)
}
+ // Also call /me/drive as sometimes /me/drives doesn't return it #4068
+ if opts.Path == "/me/drives" {
+ opts.Path = "/me/drive"
+ meDrive := driveResource{}
+ _, err := srv.CallJSON(ctx, &opts, nil, &meDrive)
+ if err != nil {
+ log.Fatalf("Failed to query available drives: %v", err)
+ }
+ found := false
+ for _, drive := range drives.Drives {
+ if drive.DriveID == meDrive.DriveID {
+ found = true
+ break
+ }
+ }
+ // add the me drive if not found already
+ if !found {
+ fs.Debugf(nil, "Adding %v to drives list from /me/drive", meDrive)
+ drives.Drives = append(drives.Drives, meDrive)
+ }
+ }
+
if len(drives.Drives) == 0 {
log.Fatalf("No drives found")
} else {