carddav: don't support PROPPATCH

PROPPATCH can't be used to change an address object's data. For now,
let's not support it.
This commit is contained in:
Simon Ser 2020-01-22 14:50:57 +01:00
parent 6de76c94b8
commit bf97060e19
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -247,6 +247,7 @@ func (b *backend) propfindAddressObject(propfind *internal.Propfind, ao *Address
internal.GetContentTypeName: func(*internal.RawXMLValue) (interface{}, error) { internal.GetContentTypeName: func(*internal.RawXMLValue) (interface{}, error) {
return &internal.GetContentType{Type: vcard.MIMEType}, nil return &internal.GetContentType{Type: vcard.MIMEType}, nil
}, },
// TODO: address-data can only be used in REPORT requests
addressDataName: func(*internal.RawXMLValue) (interface{}, error) { addressDataName: func(*internal.RawXMLValue) (interface{}, error) {
var buf bytes.Buffer var buf bytes.Buffer
if err := vcard.NewEncoder(&buf).Encode(ao.Card); err != nil { if err := vcard.NewEncoder(&buf).Encode(ao.Card); err != nil {
@ -262,7 +263,9 @@ func (b *backend) propfindAddressObject(propfind *internal.Propfind, ao *Address
} }
func (b *backend) Proppatch(r *http.Request, update *internal.Propertyupdate) (*internal.Response, error) { func (b *backend) Proppatch(r *http.Request, update *internal.Propertyupdate) (*internal.Response, error) {
panic("TODO") // TODO: return a failed Response instead
// TODO: support PROPPATCH for address books
return nil, internal.HTTPErrorf(http.StatusForbidden, "carddav: PROPPATCH is unsupported")
} }
func (b *backend) Put(r *http.Request) error { func (b *backend) Put(r *http.Request) error {