"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
webdav: read the body of messages into the error if XML parse fails
Nick Craig-Woodb07e51cf739f
diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.goindex 86ec2e0a8..cc81fd329 100644--- a/backend/webdav/webdav.go+++ b/backend/webdav/webdav.go@@ -19,6 +19,7 @@ package webdav// For example the ownCloud WebDAV server does it that way.import (+ "encoding/xml""fmt""io""net/http"@@ -209,11 +210,16 @@ func (f *Fs) readMetaDataForPath(path string) (info *api.Prop, err error) {// errorHandler parses a non 2xx error response into an errorfunc errorHandler(resp *http.Response) error {+ body, err := rest.ReadBody(resp)+ if err != nil {+ return errors.Wrap(err, "error when trying to read error from body")+ }// Decode error responseerrResponse := new(api.Error)- err := rest.DecodeXML(resp, &errResponse)+ err = xml.Unmarshal(body, &errResponse)if err != nil {- fs.Debugf(nil, "Couldn't decode error response: %v", err)+ // set the Message to be the body if can't parse the XML+ errResponse.Message = strings.TrimSpace(string(body))}errResponse.Status = resp.StatuserrResponse.StatusCode = resp.StatusCode