contacts icon indicating copy to clipboard operation
contacts copied to clipboard

Export randomly escapes commas, and converts spaces into escaped commas, causing 3rd-party clients to render them as ",".

Open RokeJulianLockhart opened this issue 1 year ago • 7 comments

Describe the bug

Export of a contact converts spaces in its prefix into "\,", causing 3rd-party clients to render what should be spaces as ",".

Steps to reproduce

  1. Create a contact with a prefix which contains spaces.

  2. Export it to a .VCF.

  3. Delete the contact in the database.

  4. Import the .VCF.

  5. Synchronize the address book via https://github.com/bitfireAT/davx5-ose/releases/download/v4.4.0.1-ose/davx5-ose-4.4.0.1-ose-release.apk.

  6. View the contact via https://github.com/FossifyOrg/Contacts/releases/download/1.0.1/contacts-2-foss-release.apk.

Expected behavior

The prefix should render as "WordOne WordTwo".

Actual behavior

The prefix renders as "WordOne,WordTwo".

Contact version

Unknown, but at most, https://github.com/nextcloud/contacts/releases/tag/v5.0.1.

Operating system

cpe:/o:canonical:ubuntu

PHP engine version

None

Web server

nginx/1.18.0

Database

{ "needsDbUpgrade": false }

^1

RokeJulianLockhart avatar Jun 15 '24 21:06 RokeJulianLockhart

This is what I tried and couldn't reproduce

  1. Create contact John Doe
  2. Export contact
  3. Delete it
  4. Import it.
  5. still John Doe

hamza221 avatar Jul 01 '24 14:07 hamza221

https://github.com/nextcloud/contacts/issues/3985#issuecomment-2200283644

Response

@hamza221, that's not descriptive enough for me to advise you on - what fields specifically did you fill, and what with? As an example, if you just put the N as N:Doe;John;;;, indeed that's not going to work, because you've not used the prefix section.

Diagnosis

  1. However, it appears that my initial conclusion - that this consistently and solely affected the prefix section - was incorrect, for I can export some .VCFs without a space in the prefix causing the space to be escaped. Regardless, I can still reproduce this with some contacts:

    BEGIN:VCARD
    VERSION:3.0
    PRODID:-//Sabre//Sabre VObject 4.4.2//EN
    UID:2750273e-c364-4c25-b92c-aae2e3ed6efe
    FN:REDA REDACTE
    N:REDACTE;REDA;;Junior\,Soldier;
    ORG:HM Armed Forces
    TITLE:NATO STANAG 2116 OR-2
    TEL;TYPE=cell:+44-0000-000000
    EMAIL;TYPE=home:@ArmyMail.MOD.UK
    REV;VALUE=DATE-AND-OR-TIME:20240702T160920Z
    END:VCARD
    
    

    I've replaced the lad's actual name with "REDACTED", concatenated to the exact length of his original name. (I have to, for his sake.) I can't imagine that the actual characters matter much anyway.

  2. In trying to diagnose this, I've noticed that it affects more fields, too, like NEXTCLOUD1.TEL - below is an example exported .VCF:

    BEGIN:VCARD
    VERSION:3.0
    PRODID:-//Sabre//Sabre VObject 4.4.2//EN
    UID:7b002174-34ac-4efb-ba9b-474e8687e111
    FN:Example First Example Last
    N:Example Last;Example First;Example Middle;Example Prefix;Example Suffix
    NICKNAME:Example Nickname
    ORG:Example Organization
    NEXTCLOUD1.TEL:+44-1234-123456\,123
    NEXTCLOUD2.EMAIL;TYPE=home:[email protected]
    URL;VALUE=URI:ftp://example:[email protected]
    URL;VALUE=URI:HTTPS://example:[email protected]
    NEXTCLOUD3.ADR;TYPE=home:Example Post Office Box;Example Extended Address;E
     xample Address;Example City;Example State or Province;Example Postcode;Exa
     mple Country
    NOTE:HTTPS://WWW.markdownguide.org/extended-syntax/\n\n<blockQuote>\n\n| Sy
     ntax      | Description | Test Text     |\n| :---        |    :----:   |  
           ---: |\n| Header      | Title       | Here's this   |\n| Paragraph  
      | Text        | And more      |\n\n```\n{\n  "firstName": "John"\,\n  "la
     stName": "Smith"\,\n  "age": 25\n}\n```\n\nHere's a simple footnote\,[^1] 
     and here's a longer one.[^bignote]\n\n[^1]: This is the first footnote.\n\
     n[^bignote]: Here's one with multiple paragraphs and code.\n\n    Indent p
     aragraphs to include them in the footnote.\n\n    `{ my code }`\n\n    Add
      as many paragraphs as you like.\n\n### My Great Heading {#custom-id}\n\nF
     irst Term\n: This is the definition of the first term.\n\nSecond Term\n: T
     his is one definition of the second term.\n: This is another definitionof 
     the second term.\n\n- [x] Write the press release\n- [ ] Update the websit
     e\n- [ ] Contact the media\n\nGone camping! :tent: Be back soon.\n\nThat i
     s so funny! :joy:\n\nI need to highlight these ==very important words==.\n
     \nH<sub>2</sub>O\n\n`HTTPS://WWW.example.com`\n\n</blockQuote>
    REV;VALUE=DATE-AND-OR-TIME:20240702T160410Z
    TITLE:Example Title
    NEXTCLOUD1.X-ABLABEL:Example Label
    NEXTCLOUD2.X-ABLABEL:Example Label
    NEXTCLOUD3.X-ABLABEL:Example Label
    X-PHONETIC-FIRST-NAME:Example Phonetic First Name
    X-PHONETIC-LAST-NAME:Example Phonetic Last Name
    GEO;VALUE=URI:geo:90.000\,0.000
    RELATIONSHIP:ASSISTANT
    TZ:Europe/London
    X-MANAGERSNAME;UID=e1f2ec5c-074e-4875-ac62-53ff24770ffa:Roke Beedell
    END:VCARD
    
    

    Notice NEXTCLOUD1.TEL:+44-1234-123456\,123. The comma is the standard extension denotation syntax, and definitely wasn't escaped by myself - that's the work of the exporter.

RokeJulianLockhart avatar Jul 02 '24 16:07 RokeJulianLockhart

Hi there! It looks like this issue hasn’t seen much activity for a while and might need a bit more information to move forward. If we don’t hear back soon, we may close it to keep things organized. Thanks again for your contributions – we really appreciate it!

nextcloud-command avatar Nov 01 '24 01:11 nextcloud-command

Hi there! It looks like this issue hasn’t seen much activity for a while and might need a bit more information to move forward. If we don’t hear back soon, we may close it to keep things organized. Thanks again for your contributions – we really appreciate it!

nextcloud-command avatar Dec 09 '24 01:12 nextcloud-command

https://github.com/nextcloud/contacts/issues/3985#issuecomment-2526621273

@nextcloud-command, if you've desired information, request it. That second comment should be hidden as duplicate.

RokeJulianLockhart avatar Dec 09 '24 20:12 RokeJulianLockhart

Hi there! It looks like this issue hasn’t seen much activity for a while and might need a bit more information to move forward. If we don’t hear back soon, we may close it to keep things organized. Thanks again for your contributions – we really appreciate it!

nextcloud-command avatar Jan 09 '25 02:01 nextcloud-command

https://github.com/nextcloud/contacts/issues/3985#issuecomment-2579033177

@nextcloud-command, as aforestated.

RokeJulianLockhart avatar Jan 09 '25 14:01 RokeJulianLockhart