diff --git a/vfs/rc.go b/vfs/rc.go index 081e9f5da..e6aa4bae4 100644 --- a/vfs/rc.go +++ b/vfs/rc.go @@ -23,6 +23,8 @@ must be supplied.` // // If "fs" is not set and there is one and only one VFS in the active // cache then it returns it. This is for backwards compatibility. +// +// This deletes the "fs" parameter from in if it is valid func getVFS(in rc.Params) (vfs *VFS, err error) { fsString, err := in.GetString("fs") if rc.IsErrParamNotFound(err) { @@ -46,6 +48,7 @@ func getVFS(in rc.Params) (vfs *VFS, err error) { } else if len(activeVFS) > 1 { return nil, errors.Errorf("more than one VFS active with name %q", fsString) } + delete(in, "fs") // delete the fs parameter return activeVFS[0], nil } diff --git a/vfs/rc_test.go b/vfs/rc_test.go index 0e31ef0a9..096ce5768 100644 --- a/vfs/rc_test.go +++ b/vfs/rc_test.go @@ -57,6 +57,7 @@ func TestRcGetVFS(t *testing.T) { assert.Contains(t, err.Error(), "more than one VFS active - need") assert.Nil(t, vfs) + inPresent = rc.Params{"fs": fs.ConfigString(r.Fremote)} vfs, err = getVFS(inPresent) require.Error(t, err) assert.Contains(t, err.Error(), "more than one VFS active with name") @@ -67,7 +68,8 @@ func TestRcForget(t *testing.T) { r, vfs, cleanup, call := rcNewRun(t, "vfs/forget") defer cleanup() _, _ = r, vfs - out, err := call.Fn(context.Background(), nil) + in := rc.Params{"fs": fs.ConfigString(r.Fremote)} + out, err := call.Fn(context.Background(), in) require.NoError(t, err) assert.Equal(t, rc.Params{ "forgotten": []string{}, @@ -79,7 +81,8 @@ func TestRcRefresh(t *testing.T) { r, vfs, cleanup, call := rcNewRun(t, "vfs/refresh") defer cleanup() _, _ = r, vfs - out, err := call.Fn(context.Background(), nil) + in := rc.Params{"fs": fs.ConfigString(r.Fremote)} + out, err := call.Fn(context.Background(), in) require.NoError(t, err) assert.Equal(t, rc.Params{ "result": map[string]string{