Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

librclone: allow empty string or null input instead of empty json object

albertonyfd82876086f0
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