diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go index 97dc8245f..8e84bac6e 100644 --- a/backend/onedrive/onedrive.go +++ b/backend/onedrive/onedrive.go @@ -15,6 +15,7 @@ import ( "net/url" "path" "regexp" + "sort" "strconv" "strings" "sync" @@ -505,6 +506,10 @@ func chooseDrive(ctx context.Context, name string, m configmap.Mapper, srv *rest break } } + // my OneDrive as the first drive + sort.SliceStable(drives.Drives, func(i, j int) bool { + return drives.Drives[i].DriveID == meDrive.DriveID + }) // add the me drive if not found already if !found { fs.Debugf(nil, "Adding %v to drives list from /me/drive", meDrive)