-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
carddav: PROPPATCH support for address books #147
base: master
Are you sure you want to change the base?
Conversation
Does it help clients to advertise PROPPATCH here? Line 281 in 25f1014
|
Good call, but no. I tried, and it doesn't change anything. For DavX5, there isn't even an option to change it, which seems to be a known issue, and e.g. CardBook never does an OPTIONS request anyways. Evolution does do one, but still doesn't bother ¯\_(ツ)_/¯ |
for _, prop := range update.Remove { | ||
emptyVal := internal.NewRawXMLElement(prop.Prop.XMLName, nil, nil) | ||
if err := resp.EncodeProp(http.StatusNotImplemented, emptyVal); err != nil { | ||
return nil, err | ||
for _, raw := range prop.Prop.Raw { | ||
rxn, ok := raw.XMLName() | ||
if !ok { | ||
return nil, fmt.Errorf("failed to parse properties") | ||
} | ||
emptyVal := internal.NewRawXMLElement(rxn, nil, nil) | ||
if err := resp.EncodeProp(http.StatusMethodNotAllowed, emptyVal); err != nil { | ||
return nil, err | ||
} | ||
} | ||
} | ||
for _, prop := range update.Set { | ||
emptyVal := internal.NewRawXMLElement(prop.Prop.XMLName, nil, nil) | ||
if err := resp.EncodeProp(http.StatusNotImplemented, emptyVal); err != nil { | ||
return nil, err | ||
for _, raw := range prop.Prop.Raw { | ||
rxn, ok := raw.XMLName() | ||
if !ok { | ||
return nil, fmt.Errorf("failed to parse properties") | ||
} | ||
emptyVal := internal.NewRawXMLElement(rxn, nil, nil) | ||
if err := resp.EncodeProp(http.StatusMethodNotAllowed, emptyVal); err != nil { | ||
return nil, err | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to write out a multi-status here? Can't we just reply with a toplevel HTTP status instead? Something like internal.HTTPErrorf
?
} | ||
default: | ||
emptyVal := internal.NewRawXMLElement(rxn, nil, nil) | ||
if err := resp.EncodeProp(http.StatusNotImplemented, emptyVal); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a 404 be more appropriate for the properties we don't know about?
OK, too bad. Can we still advertise |
4de6415
to
20d0ee3
Compare
Changed the interface so that the backend can implement UpdateAddressbook atomically, also simplified some things a bit. |
The groundwork for address objects is also there, but it's not fully implemented.
I'll be honest: none of the usual suspects (DavX5, TB/CardBook, Evolution) actually use this, but that just makes me mad. They all rename address books client side only (or not at all). However, since PROPPATCH is a standard WebDAV operation, I successfully renamed my address books on the server using cadaver. I still think this is worth implementing, because if any sane client ever comes along, they might really want to use this.
Regarding the support for address objects, it might be worth taking a closer look at the worthwhileness before going through with it. I suspect that again no major client actually uses it, and for address objects it's also slightly less useful (because e.g. the "displayname" property is likely not used, because a contact is displayed by its name, etc.).