Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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 {
+6 −0
Original line number Diff line number Diff line
@@ -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() {
+21 −0
Original line number Diff line number Diff line
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