1
mirror of https://github.com/rclone/rclone synced 2024-12-21 11:45:56 +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

View File

@ -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)