Skip to content

Commit

Permalink
Add a proper XML header to error replies.
Browse files Browse the repository at this point in the history
See #273 for more details.
  • Loading branch information
Klaas Freitag committed Jun 27, 2021
1 parent 8006cdf commit ed6cfc8
Showing 1 changed file with 5 additions and 1 deletion.
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(xml.Header + string(xmlstring)), err
}
return []byte(""), err
}

// http://www.webdav.org/specs/rfc4918.html#ELEMENT_error
Expand Down

0 comments on commit ed6cfc8

Please sign in to comment.