Skip to content

Commit

Permalink
jmap_contact: do not set "urn:uuid:" twice in UID
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Stepanek <[email protected]>
  • Loading branch information
rsto committed Aug 2, 2023
1 parent 82fb79c commit 489520c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cassandane/tiny-tests/JMAPContacts/cardgroup-set-create
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ sub test_cardgroup_set_create
$self->assert_matches(qr/KIND:GROUP/, $card);
$self->assert_matches(qr/UID:$id/, $card);
$self->assert_matches(qr/FN:$name/, $card);
$self->assert_matches(qr/MEMBER:urn:uuid:$member1/, $card);
$self->assert_matches(qr/MEMBER:urn:uuid:$member2/, $card);
$self->assert_matches(qr/MEMBER:$member1/, $card);
$self->assert_matches(qr/MEMBER:$member2/, $card);
$self->assert_does_not_match(qr/N:;/, $card);
}
20 changes: 17 additions & 3 deletions imap/jmap_contact.c
Original file line number Diff line number Diff line change
Expand Up @@ -1906,7 +1906,12 @@ static int _add_group_entries(struct jmap_req *req,
buf_reset(&buf);
continue;
}
buf_setcstr(&buf, "urn:uuid:");

buf_reset(&buf);
if (strncmpsafe("urn:uuid:", uid, 9)) {
buf_setcstr(&buf, "urn:uuid:");
}

buf_appendcstr(&buf, uid);
vparse_add_entry(card, NULL, group_propname, buf_cstring(&buf));
buf_reset(&buf);
Expand Down Expand Up @@ -1936,7 +1941,12 @@ static int _add_othergroup_entries(struct jmap_req *req,
buf_reset(&buf);
continue;
}
buf_setcstr(&buf, "urn:uuid:");

buf_reset(&buf);
if (strncmpsafe("urn:uuid:", uid, 9)) {
buf_setcstr(&buf, "urn:uuid:");
}

buf_appendcstr(&buf, uid);
struct vparse_entry *entry =
vparse_add_entry(card, NULL,
Expand Down Expand Up @@ -8311,7 +8321,11 @@ static unsigned _jsmultikey_to_card(struct jmap_parser *parser, json_t *jval,
vcardproperty_set_value(prop, vcardvalue_new_textlist(text));
}
else if (pkind == VCARD_MEMBER_PROPERTY) {
buf_setcstr(&buf, "urn:uuid:");
buf_reset(&buf);
if (strncmpsafe("urn:uuid:", id, 9)) {
buf_setcstr(&buf, "urn:uuid:");
}

buf_appendcstr(&buf, id);
vcardproperty_set_value_from_string(prop, buf_cstring(&buf), "NO");
}
Expand Down

0 comments on commit 489520c

Please sign in to comment.