operations: resume downloads if the reader fails in copy - fixes #2108

This puts a shim on the reader opened by Copy so that if an error is
returned, the reader is re-opened at the correct seek point.

This should make downloading very large files more reliable.
This commit is contained in:
Nick Craig-Wood
2019-02-12 11:47:57 +00:00
parent c3eecbe933
commit 076d3da825
3 changed files with 256 additions and 1 deletions
+1 -1
View File
@@ -283,7 +283,7 @@ func Copy(f fs.Fs, dst fs.Object, remote string, src fs.Object) (newDst fs.Objec
// If can't server side copy, do it manually
if err == fs.ErrorCantCopy {
var in0 io.ReadCloser
in0, err = src.Open(hashOption)
in0, err = newReOpen(src, hashOption, fs.Config.LowLevelRetries)
if err != nil {
err = errors.Wrap(err, "failed to open source object")
} else {