mirror of
https://github.com/rclone/rclone.git
synced 2024-12-23 15:38:57 +01:00
rc: fix --loopback with rc/list and others
Before this change `rclone rc --loopback` would give the error "bad JSON". This was because the output of the `rc/list` command was not serialzed through JSON. This serializes it through JSON and fixes that (and probably other) command.
This commit is contained in:
parent
7f7946564d
commit
535f5f3c99
11
cmd/rc/rc.go
11
cmd/rc/rc.go
@ -117,7 +117,16 @@ func doCall(path string, in rc.Params) (out rc.Params, err error) {
|
|||||||
if call == nil {
|
if call == nil {
|
||||||
return nil, errors.Errorf("method %q not found", path)
|
return nil, errors.Errorf("method %q not found", path)
|
||||||
}
|
}
|
||||||
return call.Fn(context.Background(), in)
|
out, err = call.Fn(context.Background(), in)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "loopback call failed")
|
||||||
|
}
|
||||||
|
// Reshape (serialize then deserialize) the data so it is in the form expected
|
||||||
|
err = rc.Reshape(&out, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "loopback reshape failed")
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do HTTP request
|
// Do HTTP request
|
||||||
|
Loading…
Reference in New Issue
Block a user