mirror of
https://github.com/rclone/rclone
synced 2025-03-02 01:13:05 +01:00
operations: call Rcat in Copy when size is -1 - #2832
This commit is contained in:
parent
6e153781a7
commit
b8b53901e8
@ -286,6 +286,16 @@ func Copy(f fs.Fs, dst fs.Object, remote string, src fs.Object) (newDst fs.Objec
|
|||||||
in0, err = src.Open(hashOption)
|
in0, err = src.Open(hashOption)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = errors.Wrap(err, "failed to open source object")
|
err = errors.Wrap(err, "failed to open source object")
|
||||||
|
} else {
|
||||||
|
if src.Size() == -1 {
|
||||||
|
// -1 indicates unknown size. Use Rcat to handle both remotes supporting and not supporting PutStream.
|
||||||
|
if doUpdate {
|
||||||
|
actionTaken = "Copied (Rcat, replaced existing)"
|
||||||
|
} else {
|
||||||
|
actionTaken = "Copied (Rcat, new)"
|
||||||
|
}
|
||||||
|
dst, err = Rcat(f, remote, in0, src.ModTime())
|
||||||
|
newDst = dst
|
||||||
} else {
|
} else {
|
||||||
in := accounting.NewAccount(in0, src).WithBuffer() // account and buffer the transfer
|
in := accounting.NewAccount(in0, src).WithBuffer() // account and buffer the transfer
|
||||||
var wrappedSrc fs.ObjectInfo = src
|
var wrappedSrc fs.ObjectInfo = src
|
||||||
@ -307,6 +317,7 @@ func Copy(f fs.Fs, dst fs.Object, remote string, src fs.Object) (newDst fs.Objec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
tries++
|
tries++
|
||||||
if tries >= maxTries {
|
if tries >= maxTries {
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user