diff --git a/changelog/unreleased/xmlheadertoerrors.md b/changelog/unreleased/xmlheadertoerrors.md new file mode 100644 index 00000000000..16d0227e0b8 --- /dev/null +++ b/changelog/unreleased/xmlheadertoerrors.md @@ -0,0 +1,3 @@ +Bugfix: send a proper XML header with error messages + +https://github.com/cs3org/reva/pull/1828 diff --git a/internal/http/services/owncloud/ocdav/error.go b/internal/http/services/owncloud/ocdav/error.go index b8947481d81..db1ada84465 100644 --- a/internal/http/services/owncloud/ocdav/error.go +++ b/internal/http/services/owncloud/ocdav/error.go @@ -58,13 +58,17 @@ type exception struct { // Marshal just calls the xml marshaller for a given exception. func Marshal(e exception) ([]byte, error) { - return xml.Marshal(&errorXML{ + xmlstring, err := xml.Marshal(&errorXML{ Xmlnsd: "DAV", Xmlnss: "http://sabredav.org/ns", Exception: codesEnum[e.code], Message: e.message, Header: e.header, }) + if err != nil { + return []byte(""), err + } + return []byte(xml.Header + string(xmlstring)), err } // http://www.webdav.org/specs/rfc4918.html#ELEMENT_error