From 5433021e8b0d517c134da6a81d51c787403db1ac Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 4 Jul 2019 08:13:27 +0100 Subject: [PATCH] drive: fix server side copy of big files Before this change rclone was sending a MimeType in the requests for server side Move and Copy. The conjecture is that if you attempt to set the MimeType to something different in a Copy then Google Drive has to do an actual copy of the file data. This takes a very long time (since it is large) and fails after a 90s timeout. After the change we no longer set the MimeType in Move or Copy and the copies happen instantly and correctly. Many thanks to @darthShadow for discovering that this was causing the problem. Fixes #3070 Fixes #3033 Fixes #3300 Fixes #3155 --- backend/drive/drive.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/drive/drive.go b/backend/drive/drive.go index c9ac6ecdd..9a1fed5bd 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -1649,7 +1649,6 @@ func (f *Fs) createFileInfo(ctx context.Context, remote string, modTime time.Tim Name: leaf, Description: leaf, Parents: []string{directoryID}, - MimeType: fs.MimeTypeFromName(remote), ModifiedTime: modTime.Format(timeFormatOut), } return createInfo, nil @@ -1713,6 +1712,8 @@ func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, } if importMimeType != "" { createInfo.MimeType = importMimeType + } else { + createInfo.MimeType = fs.MimeTypeFromName(remote) } var info *drive.File