mirror of
https://github.com/rclone/rclone.git
synced 2024-12-24 16:09:01 +01:00
rcat: honor --dry-run even for small files
This commit is contained in:
parent
80b1f2a494
commit
a91448c83a
@ -1618,6 +1618,10 @@ func Rcat(fdst Fs, dstFileName string, in0 io.ReadCloser, modTime time.Time) (er
|
|||||||
in := ioutil.NopCloser(bytes.NewReader(buf[:n]))
|
in := ioutil.NopCloser(bytes.NewReader(buf[:n]))
|
||||||
in = NewAccountSizeName(in, int64(n), dstFileName).WithBuffer()
|
in = NewAccountSizeName(in, int64(n), dstFileName).WithBuffer()
|
||||||
objInfo := NewStaticObjectInfo(dstFileName, modTime, int64(n), false, nil, nil)
|
objInfo := NewStaticObjectInfo(dstFileName, modTime, int64(n), false, nil, nil)
|
||||||
|
if Config.DryRun {
|
||||||
|
Logf("stdin", "Not uploading as --dry-run")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
dst, err := fdst.Put(in, objInfo, hashOption)
|
dst, err := fdst.Put(in, objInfo, hashOption)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1646,7 +1650,7 @@ func Rcat(fdst Fs, dstFileName string, in0 io.ReadCloser, modTime time.Time) (er
|
|||||||
in = NewAccountSizeName(in, -1, dstFileName).WithBuffer()
|
in = NewAccountSizeName(in, -1, dstFileName).WithBuffer()
|
||||||
|
|
||||||
if Config.DryRun {
|
if Config.DryRun {
|
||||||
Logf("stdin", "Not copying as --dry-run")
|
Logf("stdin", "Not uploading as --dry-run")
|
||||||
// prevents "broken pipe" errors
|
// prevents "broken pipe" errors
|
||||||
_, err = io.Copy(ioutil.Discard, in)
|
_, err = io.Copy(ioutil.Discard, in)
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user