GitLab's annual major release is around the corner. Along with a lot of new and exciting features, there will be a few breaking changes. Learn more here.

Commit 1babf682 authored by Ricki Hirner's avatar Ricki Hirner 🐑
Browse files

Drop some unparseable fields which must occur only once from unknown properties

parent 207a7c32
Pipeline #24203722 passed with stages
in 3 minutes and 24 seconds
......@@ -226,6 +226,13 @@ class Contact {
c.uid = UUID.randomUUID().toString()
}
// remove properties which
// - couldn't be parsed (and thus are treated as extended/unknown properties), and
// - must occur once max.
arrayOf("ANNIVERSARY", "BDAY", "KIND", "N", "PRODID", "REV", "UID").forEach {
vCard.removeExtendedProperty(it)
}
// store all remaining properties into unknownProperties
if (vCard.properties.isNotEmpty() || vCard.extendedProperties.isNotEmpty())
try {
......
......@@ -183,6 +183,12 @@ class ContactTest {
assertEquals("My Phone", c.phoneNumbers.first.label)
}
@Test
fun testInvalidREV() {
val c = parseContact("invalid-rev.vcf")
assertFalse(c.unknownProperties!!.contains("REV"))
}
@Test
fun testVCard3FieldsAsVCard3() {
......
BEGIN:VCARD
VERSION:4.0
PRODID:+//IDN bitfire.at//DAVdroid/1.11.4.1-ose ez-vcard/0.10.4
X-EVOLUTION-FILE-AS:Xxxxxx-xxxx\, Loïc
X-EVOLUTION-MANAGER:
X-EVOLUTION-ASSISTANT:
X-EVOLUTION-SPOUSE:
X-EVOLUTION-BLOG-URL:
X-EVOLUTION-VIDEO-URL:
X-MOZILLA-HTML:FALSE
REV;VALUE=timestamp:2018-04-30T07:42:25Z(1)
CALURI:
FBURL:
UID:pas-id-0c6bbc36b403f6e885c75e4835f796bba6fcdc12
FN:Loïc Xxxxxx-xxxx
N:Xxxxxx-xxxx;Loïc;;;
ORG:xxxxxxxmail
EMAIL;TYPE=work:loic.Xxxxxx-xxxx@xxxxxxxmail.com
URL:
REV:20180619T131622Z
END:VCARD
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment