From 94b1439299e57f84dec27e865fba2b7356f3ea79 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 14 Jul 2021 10:23:35 +0100 Subject: [PATCH] drive: fix some google docs being treated as files - fixes #5455 At some point some google docs files started having sizes returned in their listing information. This then caused rclone to treat the docs as files which caused downloads to fail. The API docs now state that google docs may have sizes (whereas I'm pretty sure it didn't earlier). This fix removes the check for size, so google docs are identified solely by not having an MD5 checksum. --- backend/drive/drive.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/drive/drive.go b/backend/drive/drive.go index 240e6a189..29185b1cd 100755 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -1321,8 +1321,8 @@ func (f *Fs) newLinkObject(remote string, info *drive.File, extension, exportMim // // When the drive.File cannot be represented as an fs.Object it will return (nil, nil). func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *drive.File) (fs.Object, error) { - // If item has MD5 sum or a length it is a file stored on drive - if info.Md5Checksum != "" || info.Size > 0 { + // If item has MD5 sum it is a file stored on drive + if info.Md5Checksum != "" { return f.newRegularObject(remote, info), nil } @@ -1355,8 +1355,8 @@ func (f *Fs) newObjectWithExportInfo( // Pretend a dangling shortcut is a regular object // It will error if used, but appear in listings so it can be deleted return f.newRegularObject(remote, info), nil - case info.Md5Checksum != "" || info.Size > 0: - // If item has MD5 sum or a length it is a file stored on drive + case info.Md5Checksum != "": + // If item has MD5 sum it is a file stored on drive return f.newRegularObject(remote, info), nil case f.opt.SkipGdocs: fs.Debugf(remote, "Skipping google document type %q", info.MimeType)