From fd82876086f0c220c84ad161a9f1bb0ba0b1294e Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Sun, 24 Oct 2021 17:35:13 +0200 Subject: [PATCH] librclone: allow empty string or null input instead of empty json object --- librclone/librclone/librclone.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/librclone/librclone/librclone.go b/librclone/librclone/librclone.go index 21c5aa5d5..58e10f83b 100644 --- a/librclone/librclone/librclone.go +++ b/librclone/librclone/librclone.go @@ -88,9 +88,11 @@ func RPC(method string, input string) (output string, status int) { }() // create a buffer to capture the output - err := json.NewDecoder(strings.NewReader(input)).Decode(&in) - if err != nil { - return writeError(method, in, fmt.Errorf("failed to read input JSON: %w", err), http.StatusBadRequest) + if input != "" { + err := json.NewDecoder(strings.NewReader(input)).Decode(&in) + if err != nil { + return writeError(method, in, fmt.Errorf("failed to read input JSON: %w", err), http.StatusBadRequest) + } } // Find the call