Skip to content

[vCard] handle free-text and URI UID #101

@rfc2822

Description

@rfc2822

Currently, we drop the urn:uuid of incoming vCards:

is Uid ->
c.uid = uriToUid(prop.value)

val uid = try {
val uri = URI(uriString)
when {
uri.scheme == null ->
uri.schemeSpecificPart
uri.scheme.equals("urn", true) && uri.schemeSpecificPart.startsWith("uuid:", true) ->
uri.schemeSpecificPart.substring(5)
else ->
uriString
}
} catch(e: URISyntaxException) {
logger.warning("Invalid URI for UID: $uriString")
uriString
}

Then, when generating it again, we take the reduced UID without the prefix:

contact.uid?.let { vCard.uid = Uid(it) }

The background is that vCard 3 uses a free-text UID, while vCard 4 either uses URI or free-text, and we don't know in prior whether we have to generate the vCard as vCard 3 or vCard 4.

However the current way of handling that is inconsistent and results in undesired UID modification (urn:uuid removed even when we re-generate as vCard 4; breaks with other URI schemes etc).


As an additional challenge, MEMBER (for groups) only allows URIs. Currently, we use the "reduced" UID and always prepend urn:uuid:. Instead, we should use the correct URI, if it's available and define how we deal with the case that it's not available.

CC @rsto (thanks for notifying us about the problem)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcontacts

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions