carddav: allow created address book objects to have a different path

Closes: https://github.com/emersion/go-webdav/issues/32
This commit is contained in:
Simon Ser
2020-01-30 15:20:10 +01:00
parent 2e5aa7653b
commit dd1527b97e
3 changed files with 21 additions and 13 deletions

View File

@@ -187,18 +187,18 @@ func (b *backend) Proppatch(r *http.Request, update *internal.Propertyupdate) (*
return nil, internal.HTTPErrorf(http.StatusForbidden, "webdav: PROPPATCH is unsupported")
}
func (b *backend) Put(r *http.Request) error {
func (b *backend) Put(r *http.Request) (*internal.Href, error) {
wc, err := b.FileSystem.Create(r.URL.Path)
if err != nil {
return err
return nil, err
}
defer wc.Close()
if _, err := io.Copy(wc, r.Body); err != nil {
return err
return nil, err
}
return wc.Close()
return nil, wc.Close()
}
func (b *backend) Delete(r *http.Request) error {