Skip to content
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

Validation error in vCard: ENCODING=BASE64 is not valid for this document type #3366

Closed
beccon4 opened this issue Feb 3, 2017 · 21 comments
Closed
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: carddav Related to CardDAV internals feature: dav needs info

Comments

@beccon4
Copy link

beccon4 commented Feb 3, 2017

Steps to reproduce

  1. import an addressbook into a clean install of Nextcloud 11 containing contacts with base64 encoded images (e.g. from an older NC or OC version)
  2. Watch those contacts to be rejected (they won't import at all)

Expected behaviour
All contacts will be imported with their respective images

Actual behaviour
Contacts containing

PHOTO;TYPE=JPEG;ENCODING=BASE64:/9j/4AA...

get rejected with a log entry like this:

`{"reqId":"cfFVmtgvP4awyLzSyMV3","remoteAddr":"10.8.0.6","app":"webdav","message":"Exception: {"Message":"HTTP\/1.1 415 Validation error in vCard: ENCODING=BASE64 is not valid for this document type.","Exception":"Sabre\\DAV\\Exception\\UnsupportedMediaType","Code":0,"Trace":"#0 \/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/CardDAV\/Plugin.php(316): Sabre\\CardDAV\\Plugin->validateVCard('BEGIN:VCARD\\r\\nVE...', false)\n#1 [internal function]: Sabre\\CardDAV\\Plugin->beforeCreateFile('addressbooks\/us...', 'BEGIN:VCARD\\r\\nVE...', Object(OCA\\DAV\\CardDAV\\AddressBook), false)\n#2 \/var\/www\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#3 \/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(1070): Sabre\\Event\\EventEmitter->emit('beforeCreateFil...', Array)\n#4 \/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php(525): Sabre\\DAV\\Server->createFile('addressbooks\/us...', 'BEGIN:VCARD\\r\\nVE...', NULL)\n#5 [internal function]: Sabre\\DAV\\CorePlugin->httpPut(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#6 \/var\/www\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#7 \/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(479): Sabre\\Event\\EventEmitter->emit('method:PUT', Array)\n#8 \/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(254): Sabre\\DAV\\Server->invokeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#9 \/var\/www\/nextcloud\/apps\/dav\/lib\/Server.php(227): Sabre\\DAV\\Server->exec()\n#10 \/var\/www\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php(30): OCA\\DAV\\Server->exec()\n#11 \/var\/www\/nextcloud\/remote.php(165): require_once('\/var\/www\/nextcl...')\n#12 {main}","File":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/CardDAV\/Plugin.php","Line":397,"User":"beccon"}","level":4,"time":"2017-02-03T17:32:56+00:00","method":"PUT","url":"/nextcloud/remote.php/dav/addressbooks/users/beccon/contacts/a0a74a88-f56b-4005-8b45-d0bd490f366c.vcf","user":"beccon","version":"11.0.1.2"}

`

@nickvergessen
Copy link
Member

Can you provide us with the vcard you are trying to import?
If you don't want to post it publicly feel free to send to <my username>@nextcloud.com

@alexdetsch
Copy link

I have this error too. Here a vCard that cannot be imported, resulting in the error above:

BEGIN:VCARD VERSION:3.0 UID:/remote.php/dav/addressbooks/users/alex.detsch/Kontakte/de027e31-893a-4 1da-b77b-6e948dbbc134.vcf N;CHARSET=utf-8:Mustermann;Max;;; FN;CHARSET=utf-8:Max Mustermann X-MS-OL-DEFAULT-POSTAL-ADDRESS:0 EMAIL;TYPE=PREF,INTERNET:m.r@domain.de X-MS-CARDPICTURE;TYPE=JP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WJVSVGKAG+WN25z17CmvJt4UY96RCS5JPQU1+XNADV+duTRTfpRQBZjHzD 86WY8AUsY4J/CmOV3c8n0oAIxhc+9R7QPvH8BUjHEfpxUVAAXx90YoplFAF7olVh8zfU1YlOIz 71DH97PoKACQ8Ae+ajp0n3segxTaAGUUUUAWpjyBTYx8vPc0khyxp3RPw/nQBCTkk0UUUAMooo oAs7lY4I60rYI+p9aYn3snsKH6j2FACeX7mm7D2IP40mcHil3sO+frQA0qR2opfM9vyNFAEqfc b8Ka/wDrD9aKKAGHrSZoooAbRRRQB//Z X-MS-OL-DESIGN;CHARSET=utf-8:<card xmlns="http://schemas.microsoft.com/offi ce/outlook/12/electronicbusinesscards" ver="1.0" layout="left" bgcolor="ff ffff"><img xmlns="" align="fit" area="16" use="cardpicture"/><fld xmlns="" prop="name" align="left" dir="ltr" style="b" color="000000" size="10"/><f ld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="email" align="left" dir="ltr" color="d48d2a" size="8"/><fld xmlns="" prop="blank" size="8"/>< fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/>< fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/>< fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/>< fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/>< fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/>< fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/>< /card> REV:20160522T185141Z END:VCARD

@hebgit
Copy link

hebgit commented Jun 29, 2017

I use Z-Push and have the same problem when changing contacts with pictures. Is there any solution?

@MorrisJobke
Copy link
Member

cc @georgehrke

@Webbeh
Copy link

Webbeh commented Dec 4, 2017

Same problem when syncing from my BlackBerry Passport, using Vcard format 2.1 if I recall correctly.

Gist : https://gist.github.com/Webbeh/4b544a82714136dc1962deef4cc03fe3

Can't, sadly, attach the VCard, because BlackBerry doesn't export them in the same way if you do it manually.

EDIT:
After adding "BASE64" in the allowed encoding list for vCard version 3.0 in 3rdparty/sabre/vobject/lib/Property.php, the vcard is imported correctly in NextCloud.

@timmmmmey
Copy link

After adding "BASE64" in the allowed encoding list for vCard version 3.0 in 3rdparty/sabre/vobject/lib/Property.php, the vcard is imported correctly in NextCloud.

Works for me as well. Could we add this a offical fix?

@hebgit
Copy link

hebgit commented May 18, 2018

I had the same problem and Webbeh's solution is working for me as well.

@Webbeh
Copy link

Webbeh commented May 18, 2018

I understand that ENCODING=BASE64 is not valid in the official DAV specifications, but accepting it adds compatibility with poorly written implementations, and I don't think it would actually hurt to add it.

@Webbeh
Copy link

Webbeh commented Jun 6, 2018

I updated the GIST with the same error on 13.0.2.1.

Fixed in the same way, adding "BASE64" as allowed encoding in Property.php for vCard v3.

UPDATE : Same fix in 13.0.4

UPDATE 2 :
I just submitted a PR in the upstream vobject library in sabre-io, if anyone is interested in commenting on this.
sabre-io/vobject#415

@msberends
Copy link

Can this be merged? This is an annoying issue...

@nextcloud-bot nextcloud-bot removed the stale Ticket or PR with no recent activity label Sep 3, 2018
@msberends
Copy link

Don't mind, I now see it's a 3rd party library.
For anyone getting here and who cannot wait for sabre to solve this: https://github.com/sabre-io/vobject/pull/415/files fixes it all.

@msberends
Copy link

Bump!

The issue 51d7d7 was closed, but not fixed. Subsequently, ENCODIG=BASE64 is still not supported. I made a comment in that Pull Request about this.

@kesselb
Copy link
Contributor

kesselb commented Dec 13, 2018

ENCODING=BASE64 is not valid in vCard 3. Supporting broken vCard implementations is kind of a bad idea, because it means that sabre/dav will also serve broken vCards to other clients.

I think you should report the bug first to blackberry and see if they can fix it. If they refuse or don't respond, we can reopen this discussion.

sabre-io/vobject#415 (comment)

I didn't know!

In that case, I would propose the following:

Change your PR to not remove the error, but instead 'repair' the problem (with the REPAIR option) . Repairing in this case is simply changing the BASE64 into B and setting the warning level to 1 instead of 3 (but only if REPAIR was passed).

sabre/dav will call validate with the repair option by default, so this should fix your problem in a more correct way

sabre-io/vobject#415 (comment)

Don't mind, I now see it's a 3rd party library.

What do you suggest? First this needs to be fixed in sabre/vobject. Are you using a blackberry with OS10 as well?

@Webbeh
Copy link

Webbeh commented Dec 25, 2018

sabre-io/vobject#441

I suggested a PR for this to finally be resolved upstream, with a proper repairing of the vCard instead of a simple hack to allow the badly formatted one to pass.

Hopefully this will be solved quite soon.

@Webbeh
Copy link

Webbeh commented Dec 26, 2018

This has now been resolved upstream, with the aforementioned PR.
@nickvergessen

Sorry danielkesselberg, went for 1b :)

@msberends
Copy link

msberends commented Dec 26, 2018 via email

@kesselb
Copy link
Contributor

kesselb commented Dec 27, 2018

  1. Pull Request is merged but there is no release yet with this patch. There are two ways to go ahead:
    a. Wait for a new release and update 3rdparty
    b. Apply patch to 3rdparty
  2. Create a pull request here to use the new 3rdparty submodule.

3rdparty? https://github.com/nextcloud/3rdparty/ this repository is linked to this repository as git submodule. Dependencies are updated there.

I would go for 1a like i did here for the same dependency: https://github.com/nextcloud/3rdparty/pull/191/files (wget https://patch-diff.githubusercontent.com/raw/sabre-io/vobject/pull/441.patch, patch < 441.patch and commit changes to 3rdparty repository, setup a new pr)

@skjnldsv skjnldsv added the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label Jun 12, 2019
@skjnldsv skjnldsv closed this as completed Feb 5, 2020
@skjnldsv
Copy link
Member

skjnldsv commented Feb 5, 2020

Wow still not merged

@skjnldsv skjnldsv reopened this Feb 5, 2020
@skjnldsv skjnldsv added 3. to review Waiting for reviews and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Feb 5, 2020
@tcitworld tcitworld added the feature: carddav Related to CardDAV internals label Dec 17, 2021
@vasaka
Copy link

vasaka commented Sep 9, 2022

Still a problem.

I believe it is premature to drop vCard v2.1 support since android exports in v2.1 format to these days, as a result I can't sync or import contacts

@kesselb
Copy link
Contributor

kesselb commented Sep 9, 2022

PR was merged and our version of sabre already contains the patch. Is there something left to do?

@szaimen
Copy link
Contributor

szaimen commented Nov 26, 2022

Hi, please update to at least 23.0.12 and report back if it fixes the issue. Thank you!

@szaimen szaimen added 0. Needs triage Pending check for reproducibility or if it fits our roadmap and removed 3. to review Waiting for reviews labels Nov 26, 2022
@szaimen szaimen closed this as completed Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: carddav Related to CardDAV internals feature: dav needs info
Projects
None yet
Development

Successfully merging a pull request may close this issue.