Skip to content

Commit

Permalink
Add a proper XML header to error replies. (cs3org#1828)
Browse files Browse the repository at this point in the history
  • Loading branch information
dragotin authored and tmourati committed Jul 12, 2021
1 parent af6b700 commit 5588d9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog/unreleased/xmlheadertoerrors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bugfix: send a proper XML header with error messages

https://github.com/cs3org/reva/pull/1828
6 changes: 5 additions & 1 deletion internal/http/services/owncloud/ocdav/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5588d9a

Please sign in to comment.