mirror of
https://github.com/rclone/rclone.git
synced 2025-04-19 18:31:10 +08:00
sftp: respect --no-check-dest parameter
SFTP backend attempts to get object stats after upload. This will fail in case when uploading to folder that has only write permissions (no read, list, etc.) Change makes Update method to return "best guess" stats when --no-check-dest flag is used.
This commit is contained in:
parent
4d38424e6c
commit
d270bef4e8
@ -2214,6 +2214,15 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||
|
||||
// Stat the file after the upload to read its stats back if o.fs.opt.SetModTime == false
|
||||
if !o.fs.opt.SetModTime {
|
||||
ci := fs.GetConfig(ctx)
|
||||
if ci.NoCheckDest {
|
||||
fs.Debugf(o, "--no-check-dest is set, so returning best guess")
|
||||
o.modTime = uint32(src.ModTime(ctx).Unix())
|
||||
o.size = src.Size()
|
||||
o.mode = os.FileMode(0666) // regular file
|
||||
return nil
|
||||
}
|
||||
|
||||
err = o.stat(ctx)
|
||||
if err == fs.ErrorObjectNotFound {
|
||||
// In the specific case of o.fs.opt.SetModTime == false
|
||||
|
Loading…
x
Reference in New Issue
Block a user