onedrive: fix spurious "Couldn't decode error response: EOF" DEBUG

This DEBUG was being generated on redirects which don't have a JSON
body and is irrelevant.
This commit is contained in:
Nick Craig-Wood 2024-09-10 11:46:04 +01:00
parent d5c100edaf
commit 70f3965354

View File

@ -942,7 +942,8 @@ func errorHandler(resp *http.Response) error {
// Decode error response
errResponse := new(api.Error)
err := rest.DecodeJSON(resp, &errResponse)
if err != nil {
// Redirects have no body so don't report an error
if err != nil && resp.Header.Get("Location") == "" {
fs.Debugf(nil, "Couldn't decode error response: %v", err)
}
if errResponse.ErrorInfo.Code == "" {