Skip to content

Commit

Permalink
[buteo-sync-plugin-carddav] Fix handling of empty contact name. JB#48429
Browse files Browse the repository at this point in the history
Fix some cases that occur when both first and last name are empty for
a contact:

- The "N" field was set to a string containing semicolons, and this
string was escaped when encoded by QVersitWriter. To avoid this
escaping, add the property as a string list CompoundType instead of a
string.

- Don't include the first/last name in the "N" values as the display
label is already added to the "FN" field anyway.
  • Loading branch information
Bea Lam committed Jun 2, 2020
1 parent 1d45708 commit 323e63d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/carddav.cpp
Expand Up @@ -370,9 +370,10 @@ void CardDavVCardConverter::contactProcessed(const QContact &c, QVersitDocument
// then just assume that the display label is a useful first name.
name.setFirstName(displaylabel);
}
QString nvalue = QStringLiteral("%1;%2;;;").arg(name.lastName(), name.firstName());
static const QStringList nvalue = { "", "", "", "", "" };
QVersitProperty nProp;
nProp.setName("N");
nProp.setValueType(QVersitProperty::CompoundType);
nProp.setValue(nvalue);
d->addProperty(nProp);
}
Expand Down

0 comments on commit 323e63d

Please sign in to comment.