onedrive: fix error listing: unknown object type <nil>

This error was introduced in this commit when refactoring the list
routine.

b8591b230d onedrive: implement ListR method which gives --fast-list support

The error was caused by OneNote files not being skipped properly.
This commit is contained in:
Nick Craig-Wood 2023-11-28 18:49:38 +00:00
parent 08c460dd1a
commit f0c774156e

View File

@ -1241,10 +1241,14 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
} }
err = f.listAll(ctx, directoryID, false, false, func(info *api.Item) error { err = f.listAll(ctx, directoryID, false, false, func(info *api.Item) error {
entry, err := f.itemToDirEntry(ctx, dir, info) entry, err := f.itemToDirEntry(ctx, dir, info)
if err == nil { if err != nil {
entries = append(entries, entry) return err
} }
return err if entry == nil {
return nil
}
entries = append(entries, entry)
return nil
}) })
if err != nil { if err != nil {
return nil, err return nil, err
@ -1339,6 +1343,9 @@ func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) (
if err != nil { if err != nil {
return err return err
} }
if entry == nil {
return nil
}
err = list.Add(entry) err = list.Add(entry)
if err != nil { if err != nil {
return err return err