mirror of
https://github.com/rclone/rclone.git
synced 2026-01-13 05:53:16 +00:00
Compare commits
3 Commits
master
...
fix-sftp-i
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f418e26a2 | ||
|
|
adff67ae3b | ||
|
|
c0977d7a78 |
@@ -925,15 +925,8 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
|||||||
opt.Port = "22"
|
opt.Port = "22"
|
||||||
}
|
}
|
||||||
|
|
||||||
// get proxy URL if set
|
// Set up sshConfig here from opt
|
||||||
if opt.HTTPProxy != "" {
|
// **NB** everything else should be setup in NewFsWithConnection
|
||||||
proxyURL, err := url.Parse(opt.HTTPProxy)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to parse HTTP Proxy URL: %w", err)
|
|
||||||
}
|
|
||||||
f.proxyURL = proxyURL
|
|
||||||
}
|
|
||||||
|
|
||||||
sshConfig := &ssh.ClientConfig{
|
sshConfig := &ssh.ClientConfig{
|
||||||
User: opt.User,
|
User: opt.User,
|
||||||
Auth: []ssh.AuthMethod{},
|
Auth: []ssh.AuthMethod{},
|
||||||
@@ -1181,11 +1174,21 @@ func NewFsWithConnection(ctx context.Context, f *Fs, name string, root string, m
|
|||||||
f.mkdirLock = newStringLock()
|
f.mkdirLock = newStringLock()
|
||||||
f.pacer = fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant)))
|
f.pacer = fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant)))
|
||||||
f.savedpswd = ""
|
f.savedpswd = ""
|
||||||
|
|
||||||
// set the pool drainer timer going
|
// set the pool drainer timer going
|
||||||
if f.opt.IdleTimeout > 0 {
|
if f.opt.IdleTimeout > 0 {
|
||||||
f.drain = time.AfterFunc(time.Duration(f.opt.IdleTimeout), func() { _ = f.drainPool(ctx) })
|
f.drain = time.AfterFunc(time.Duration(f.opt.IdleTimeout), func() { _ = f.drainPool(ctx) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get proxy URL if set
|
||||||
|
if opt.HTTPProxy != "" {
|
||||||
|
proxyURL, err := url.Parse(opt.HTTPProxy)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to parse HTTP Proxy URL: %w", err)
|
||||||
|
}
|
||||||
|
f.proxyURL = proxyURL
|
||||||
|
}
|
||||||
|
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
SlowHash: true,
|
SlowHash: true,
|
||||||
|
|||||||
@@ -1273,10 +1273,14 @@ func Run(t *testing.T, opt *Opt) {
|
|||||||
assert.Equal(t, file2Copy.Path, dst.Remote())
|
assert.Equal(t, file2Copy.Path, dst.Remote())
|
||||||
|
|
||||||
// check that mutating dst does not mutate src
|
// check that mutating dst does not mutate src
|
||||||
err = dst.SetModTime(ctx, fstest.Time("2004-03-03T04:05:06.499999999Z"))
|
if !strings.Contains(fs.ConfigStringFull(f), "copy_is_hardlink") {
|
||||||
if err != fs.ErrorCantSetModTimeWithoutDelete && err != fs.ErrorCantSetModTime {
|
err = dst.SetModTime(ctx, fstest.Time("2004-03-03T04:05:06.499999999Z"))
|
||||||
assert.NoError(t, err)
|
if err != fs.ErrorCantSetModTimeWithoutDelete && err != fs.ErrorCantSetModTime {
|
||||||
assert.False(t, src.ModTime(ctx).Equal(dst.ModTime(ctx)), "mutating dst should not mutate src -- is it Copying by pointer?")
|
assert.NoError(t, err)
|
||||||
|
// Re-read the source and check its modtime
|
||||||
|
src = fstest.NewObject(ctx, t, f, src.Remote())
|
||||||
|
assert.False(t, src.ModTime(ctx).Equal(dst.ModTime(ctx)), "mutating dst should not mutate src -- is it Copying by pointer?")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete copy
|
// Delete copy
|
||||||
|
|||||||
Reference in New Issue
Block a user