roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.93k stars 1.64k forks source link

vCard: Use sabre/vobject library #9641

Open respiranto opened 2 months ago

respiranto commented 2 months ago

The vCard code currently has its own custom vCard parser. There are many issues with the current code and I deemed it better to use an external library, sabre/vobject being the apparently best choice.

See in particular the bug report #9593.

This may also help to address #9590.

respiranto commented 2 months ago

I started doing things: https://github.com/respiranto/roundcubemail/commits/devel-vcard-sabre-vobject

respiranto commented 2 months ago

Question 1: How should / can I report errors on parsing?

For (b), I'd like to cause a user-visible message like "Failed importing $person_name", "Failed importing record without name or e-mail address ($record_data)", "Failed importing vCard due to unsupported encoding".

respiranto commented 2 months ago

Question 2 (backslash handling): Would it be OK to break #4189 (and Roundcube\Tests\Framework\VCardTest::test_parse_five)?

respiranto commented 2 months ago

Question 3 (charset support): Would it be OK to reduce the set of supported charsets to that supported by sabre/vobject?

respiranto commented 2 months ago

Suggestion 4 (charset support): Restrict document charset to (and assume) UTF-8.

alecpl commented 2 months ago
  1. I would postpone error handling to later, after the whole migration is done. I guess we can do something like rcube_addressbook::set_error() and friends.
  2. It would be good to verify if GMail is still doing that. It would be good to be able to import from GMail without issues.
  3. I think we could do UTF-8 only, but we probably should investigate what GMail and others use, so we can import data from them without much hassle.
  4. Where is question 4?
respiranto commented 2 months ago
  1. OK
  2. I'll check that. Otherwise, if we assume UTF-8, removing illegal backslashes should actually not be too difficult.
  3. Any particular other software or providers that should be tested? Next to GMail, I'd definitely test Thunderbird.
  4. Reference should have been to Question 3. Corrected.
respiranto commented 2 months ago

Testing:

GMail example:

BEGIN:VCARD
VERSION:3.0
FN:Jane Doé
N:Doé;Jane;;;
item1.URL:https\://example.org/
item1.X-ABLabel:
NOTE:noté\\\:foo\:bar
CATEGORIES:myContacts
END:VCARD

Thunderbird example:

BEGIN:VCARD
VERSION:4.0
N:Doé;Jane;;;
FN:Jane Doé
NOTE:noté:foo\\:bar
UID:fdc25d89-21a0-4069-a93f-2d1a13a6260c
URL:http://exampe.org
END:VCARD
respiranto commented 2 months ago

Note that I have found 15 issues (mostly bugs) for sabre/vobject so far, all of which we should be able to work with, some of which may require workarounds.

pabzm commented 1 month ago

@respiranto Wow, I'm impressed! Thank you very much already! (I'm currently mostly distracted by other topics, unfortunately, so for me it might take a while to react to questions.)