From 2807ec1dd2c30347f9e1db6873714c0966f4eafa Mon Sep 17 00:00:00 2001 From: emersion Date: Sun, 10 Sep 2017 12:35:04 +0200 Subject: [PATCH] webdav: remove DAV: prefix hack --- webdav_test.go | 2 +- xml.go | 29 ----------------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/webdav_test.go b/webdav_test.go index 17dbe10..b03a025 100644 --- a/webdav_test.go +++ b/webdav_test.go @@ -245,7 +245,7 @@ func TestEscapeXML(t *testing.T) { func TestFilenameEscape(t *testing.T) { hrefRe := regexp.MustCompile(`([^<]*)`) - displayNameRe := regexp.MustCompile(`([^<]*)`) + displayNameRe := regexp.MustCompile(`([^<]*)`) do := func(method, urlStr string) (string, string, error) { req, err := http.NewRequest(method, urlStr, nil) if err != nil { diff --git a/xml.go b/xml.go index 3d7c253..ef69afe 100644 --- a/xml.go +++ b/xml.go @@ -221,35 +221,6 @@ type propstat struct { ResponseDescription string `xml:"DAV: responsedescription,omitempty"` } -// MarshalXML prepends the "D:" namespace prefix on properties in the DAV: namespace -// before encoding. See multistatusWriter. -func (ps propstat) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - // Convert from a propstat to an propstat. - xmlPs := propstat{ - Prop: make([]Property, len(ps.Prop)), - Status: ps.Status, - Error: ps.Error, - ResponseDescription: ps.ResponseDescription, - } - for k, prop := range ps.Prop { - xmlPs.Prop[k] = Property{ - XMLName: xml.Name(prop.XMLName), - Lang: prop.Lang, - InnerXML: prop.InnerXML, - } - } - - for k, prop := range xmlPs.Prop { - if prop.XMLName.Space == "DAV:" { - prop.XMLName = xml.Name{Space: "", Local: "D:" + prop.XMLName.Local} - xmlPs.Prop[k] = prop - } - } - // Distinct type to avoid infinite recursion of MarshalXML. - type newpropstat propstat - return e.EncodeElement(newpropstat(xmlPs), start) -} - // http://www.webdav.org/specs/rfc4918.html#ELEMENT_response // See multistatusWriter for the "D:" namespace prefix. type response struct {