1
mirror of https://github.com/rclone/rclone synced 2025-03-25 08:26:24 +01:00

backend/onedrive: my OneDrive as the default drive

set the /me/drive as the default drive to ensure it is automatically selected in non-interactive mode
This commit is contained in:
rkonfj 2024-11-28 13:56:45 +08:00
parent ab58ae5b03
commit 142fa4179e

@ -15,6 +15,7 @@ import (
"net/url" "net/url"
"path" "path"
"regexp" "regexp"
"sort"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
@ -505,6 +506,10 @@ func chooseDrive(ctx context.Context, name string, m configmap.Mapper, srv *rest
break 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 // add the me drive if not found already
if !found { if !found {
fs.Debugf(nil, "Adding %v to drives list from /me/drive", meDrive) fs.Debugf(nil, "Adding %v to drives list from /me/drive", meDrive)