VCardParser (in lift-utils) unable to parse iOS-generated VCards (fix ready to PR)

56 views
Skip to first unread message

John Marshall

unread,
May 6, 2016, 2:22:59 AM5/6/16
to Lift
Hi,
I've been successfully using the net.liftweb.util.VCardParser to parse VCards, and tried feeding it a VCard as output from iOS Contacts app (this one from the Apple iOS 9.3 Simulator):

BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//iPhone OS 9.3//EN
N:Taylor;David;;;
FN: David Taylor
TEL;type=HOME;type=VOICE;type=pref:555-610-6679
item1.ADR;type=HOME;type=pref:;;1747 Steuart Street;Tiburon;CA;94920;USA
item1.X-ABADR:us
BDAY:1998-06-15
END:VCARD

This uses a decidedly non-standard itemN.* prefix on some fields which causes the VCardParser to fail (on the '.' to be specific):

'Right([7.6] error: `:' expected but . found

[error]    

[error]    item1.ADR;type=HOME;type=pref:;;1747 Steuart Street;Tiburon;CA;94920;USA



I took a look at the code, wrote some extra tests based on these Apple VCard instances and fixed it to the extent that I needed; the '.' is included in the permitted characters and the itemN. prefix is simply discarded.

This was consistent with the only other VCard parser that handled this format I could find source for, namely the node.js parser: https://github.com/jasperla/node-vcard/blob/master/vcard.js#L51


As mentioned in the subject line, I have this fixed and ready to pull - do I go ahead and open an issue or can I simply fire off the PR?

https://github.com/themillhousegroup/framework/tree/handle-apple-vcards


Regards and thanks for all the great work,

John




Diego Medina

unread,
May 6, 2016, 7:35:56 PM5/6/16
to Lift
Thanks for bringing this up on the mailing list first, please go ahead and enter a ticket on github. I'm not sure if we could take a PR for this, for the most part you need to be a committer (which here means you need to sign a document about IP rights, etc) before you can contribute code to the framework. We have been more flexible the last couple of years, by allowing contributions to the api docs and very small changes to actual code. This is to avoid legal issues.

In this case, I think Antonio, Matt or some of the other committers will be able to give a better answer regarding accepting a pull request for this or not, just give them some time to read the mailing list.

Thanks

Diego

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Diego Medina
Lift/Scala Consultant
di...@fmpwizard.com
http://blog.fmpwizard.com/

Matt Farmer

unread,
May 7, 2016, 10:26:08 AM5/7/16
to Lift
This pull request is small enough that I’m comfortable accepting it from a non-committer. Most of the changes are test code. Framework code changes are +2/-2.

John, unless you hear any dissenting opinions in this thread go ahead and open your PR. It’ll probably miss the bus on Lift 3.0 since that’s already in RC, but it’ll be good for Lift 3.1.

Cheers,


Matt Farmer | Blog | Twitter
GPG: CD57 2E26 F60C 0A61 E6D8  FC72 4493 8917 D667 4D07

Antonio Salazar Cardozo

unread,
May 7, 2016, 10:31:35 AM5/7/16
to Lift
Agreed, let's do the PR!
Thanks,
Antonio
Cheers,
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Diego Medina
Lift/Scala Consultant
di...@fmpwizard.com
http://blog.fmpwizard.com/

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+unsubscribe@googlegroups.com.

John Marshall

unread,
May 8, 2016, 2:54:44 AM5/8/16
to Lift
Great. PR opened. Thanks again guys.
Reply all
Reply to author
Forward
0 new messages