1
0
mirror of https://github.com/rclone/rclone.git synced 2025-03-17 20:27:52 +02:00

drive, acd, onedrive: Cache the directory IDs when reading the parent directory

This makes directory listings much more efficient (one less
transaction needed) and also fixes  (which was caused by having
to look up a directory name with quotes in which isn't dealt with well
by the list routine) by not doing a directory lookup at all.
This commit is contained in:
Nick Craig-Wood 2017-06-05 12:17:19 +01:00
parent a5cfdfd233
commit 3fe9448229
3 changed files with 6 additions and 0 deletions
amazonclouddrive
drive
onedrive

@ -405,6 +405,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
switch *node.Kind {
case folderKind:
if out.IncludeDirectory(remote) {
// cache the directory ID for later lookups
f.dirCache.Put(remote, *node.Id)
dir := &fs.Dir{
Name: remote,
Bytes: -1,

@ -564,6 +564,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
// ignore object or directory
case item.MimeType == driveFolderType:
if out.IncludeDirectory(remote) {
// cache the directory ID for later lookups
f.dirCache.Put(remote, item.Id)
dir := &fs.Dir{
Name: remote,
Bytes: -1,

@ -406,6 +406,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
remote := job.Path + info.Name
if info.Folder != nil {
if out.IncludeDirectory(remote) {
// cache the directory ID for later lookups
f.dirCache.Put(remote, info.ID)
dir := &fs.Dir{
Name: remote,
Bytes: -1,