summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2022-02-04 15:24:28 +0100
committerJohn Molakvoæ (Rebase PR Action) <skjnldsv@users.noreply.github.com>2022-03-15 12:07:19 +0000
commit026ef7e01b48051d35ef97b018584884b5db9911 (patch)
treedf94d5ee30d5c2edef63b7c3850dc351232f03e1
parent67a9da359e8617b86973274ff3e248eda7432819 (diff)
Force disabling single-quote list for type parameter
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
-rw-r--r--src/models/contact.js5
-rw-r--r--src/services/updateDesignSet.js25
-rw-r--r--src/store/contacts.js2
3 files changed, 31 insertions, 1 deletions
diff --git a/src/models/contact.js b/src/models/contact.js
index 1f33343a..a3fcb13b 100644
--- a/src/models/contact.js
+++ b/src/models/contact.js
@@ -566,4 +566,9 @@ export default class Contact {
}
}
+ toStringStripQuotes() {
+ const regexp = /TYPE="([a-zA-Z-,]+)"/gm
+ const card = this.vCard.toString()
+ return card.replaceAll(regexp, 'TYPE=$1')
+ }
}
diff --git a/src/services/updateDesignSet.js b/src/services/updateDesignSet.js
index ee62e91b..672efa67 100644
--- a/src/services/updateDesignSet.js
+++ b/src/services/updateDesignSet.js
@@ -64,6 +64,30 @@ const addGroupedProperties = vCard => {
}
/**
+ * Fixes misbehaviour with TYPE quotes and separated commas
+ * Seems to have been introduced with https://github.com/mozilla-comm/ical.js/pull/387
+ *
+ * @returns {Boolean} Whether or not the design set has been altered.
+ */
+const setTypeMultiValueSeparateDQuote = () => {
+ if (
+ !ICAL.design.vcard.param.type
+ || ICAL.design.vcard.param.type.multiValueSeparateDQuote !== false
+ || !ICAL.design.vcard3.param.type
+ || ICAL.design.vcard3.param.type.multiValueSeparateDQuote !== false
+ ) {
+ // https://github.com/mozilla-comm/ical.js/blob/ba8e2522ffd30ffbe65197a96a487689d6e6e9a1/lib/ical/stringify.js#L121
+ ICAL.design.vcard.param.type.multiValueSeparateDQuote = false
+ ICAL.design.vcard3.param.type.multiValueSeparateDQuote = false
+
+ return true
+ }
+
+ return false
+}
+
+/**
+/**
* Check whether the ical.js design sets need updating (and if so, do it)
*
* @param {Array} vCard The ical.js vCard
@@ -72,6 +96,7 @@ const addGroupedProperties = vCard => {
export default function(vCard) {
let madeChanges = false
+ madeChanges |= setTypeMultiValueSeparateDQuote()
madeChanges |= removePhoneNumberValueType()
madeChanges |= addGroupedProperties(vCard)
diff --git a/src/store/contacts.js b/src/store/contacts.js
index 8f8d6098..01521391 100644
--- a/src/store/contacts.js
+++ b/src/store/contacts.js
@@ -353,7 +353,7 @@ const actions = {
rev.fromUnixTime(Date.now() / 1000)
contact.rev = rev
- const vData = contact.vCard.toString()
+ const vData = contact.toStringStripQuotes()
// if no dav key, contact does not exists on server
if (!contact.dav) {