Skip to content

Commit

Permalink
drive: fix server side copy of big files
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ncw committed Jul 5, 2019
1 parent c9f7771 commit 5433021
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/drive/drive.go
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5433021

Please sign in to comment.