mirror of
https://github.com/rclone/rclone.git
synced 2024-11-28 19:24:15 +08:00
librclone: allow empty string or null input instead of empty json object
This commit is contained in:
parent
be1a668e95
commit
fd82876086
|
@ -88,10 +88,12 @@ func RPC(method string, input string) (output string, status int) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// create a buffer to capture the output
|
// create a buffer to capture the output
|
||||||
|
if input != "" {
|
||||||
err := json.NewDecoder(strings.NewReader(input)).Decode(&in)
|
err := json.NewDecoder(strings.NewReader(input)).Decode(&in)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return writeError(method, in, fmt.Errorf("failed to read input JSON: %w", err), http.StatusBadRequest)
|
return writeError(method, in, fmt.Errorf("failed to read input JSON: %w", err), http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find the call
|
// Find the call
|
||||||
call := rc.Calls.Get(method)
|
call := rc.Calls.Get(method)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user