Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

drive: Don't return nil Object with nil error from newObject* functions.

Nick Craig-Wood2f5a2d3c48ba
diff --git a/backend/drive/drive.go b/backend/drive/drive.go
index f47f79d2a..5ac8f3f7e 100755
--- a/backend/drive/drive.go
+++ b/backend/drive/drive.go
@@ -1281,16 +1281,16 @@ func (f *Fs) newObjectWithExportInfo(
return f.newRegularObject(remote, info), nil
case f.opt.SkipGdocs:
fs.Debugf(remote, "Skipping google document type %q", info.MimeType)
- return nil, nil
+ return nil, fs.ErrorObjectNotFound
default:
// If item MimeType is in the ExportFormats then it is a google doc
if !isDocument {
fs.Debugf(remote, "Ignoring unknown document type %q", info.MimeType)
- return nil, nil
+ return nil, fs.ErrorObjectNotFound
}
if extension == "" {
fs.Debugf(remote, "No export formats found for %q", info.MimeType)
- return nil, nil
+ return nil, fs.ErrorObjectNotFound
}
if isLinkMimeType(exportMimeType) {
return f.newLinkObject(remote, info, extension, exportMimeType)
@@ -1801,7 +1801,11 @@ func (f *Fs) itemToDirEntry(remote string, item *drive.File) (fs.DirEntry, error
case f.opt.AuthOwnerOnly && !isAuthOwned(item):
// ignore object
default:
- return f.newObjectWithInfo(remote, item)
+ entry, err = f.newObjectWithInfo(remote, item)
+ if err == fs.ErrorObjectNotFound {
+ return nil, nil
+ }
+ return entry, err
}
return nil, nil
}