-
Notifications
You must be signed in to change notification settings - Fork 173
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
Use correct syntax for vCard version when saving #1393
Use correct syntax for vCard version when saving #1393
Conversation
f49216c
to
fd7f83a
Compare
Codecov Report
@@ Coverage Diff @@
## master #1393 +/- ##
=======================================
Coverage 62.31% 62.31%
=======================================
Files 4 4
Lines 69 69
=======================================
Hits 43 43
Misses 26 26 Continue to review full report at Codecov.
|
Ok, this is annoying. While testing something else, I noticed an issue with this fix: When saving a vCard in 3.0 format, ical.js adds
According to the RFC this is correct, but our DAV backend doesn't recognise this value type and throws an error instead. I filed a PR for that (sabre-io/vobject#486) but even if this was merged, tagged and included in Nextcloud as soon as possible, older Nextcloud versions would still be broken. From what I understand, the Contacts app could be updated independently from Nextcloud, so that's a no-no. @skjnldsv What would be your preferred way to deal with this? The issue is with this line here: https://github.com/mozilla-comm/ical.js/blob/master/lib/ical/design.js#L830 The RFC doesn't actually require the value to be explicitely set, so if we patch the vCard 3 design set simliarly to what I've done in #1394 (something like An alternative would be to build a dedicated check that fixes these cases by explicitely making the value type |
Wow, well done!! I couldn't figure it out and ran out ot time for contacts with other projects :)
We can backport it then. So let's still add this to our backend for compatibility, |
And thanks a lot @hanzi! This is awesome work!! :D |
Previously, vCards were always serialised in vCard 4.0 syntax, even if the vCard version was actually set to something else. Signed-off-by: Christian Kraus <hanzi@hanzi.cc>
…re-io/vobject Signed-off-by: Christian Kraus <hanzi@hanzi.cc>
fd7f83a
to
b9f63e6
Compare
I agree, that would be preferable. But since sabre-io/vobject is a dependency of nextcloud/server we cannot rely on the backend having been fixed already: The user might use a fixed version of Contacts with an older version of Nextcloud Server. So this workaround is still necessary. Anyway, I included the design set fix. Had no further issues with phone numbers while testing. |
This changes the API used for serialising the vCard object into a string.
The previous method called
ical.stringify
on the underlying jCal object directly, which would always use vCard 4.x syntax regardless of the actual version used in the object.If the vCard was still in 3.0 format, that would lead to invalid syntax being used. While clients seem to tolerate this most of the time, it breaks DAVx5 photo import.
Here's how the new call is being implemented in ical.js:
https://github.com/mozilla-comm/ical.js/blob/master/lib/ical/component.js#L487
fixes #1312