summaryrefslogtreecommitdiffstats
path: root/src/services
diff options
context:
space:
mode:
authorChristian Kraus <hanzi@hanzi.cc>2020-01-06 12:41:35 +0100
committerChristian Kraus <hanzi@hanzi.cc>2020-01-06 12:41:35 +0100
commitb9f63e63dab323ca4fb058b74960da7265415b76 (patch)
treef890cf0e9820c90b6edfc39e878d3a9c929dc5ff /src/services
parent16001ab488bbf0464c665a9d093f5c0d7f97eec2 (diff)
Make sure we don't include 'VALUE=PHONE-NUMBER' to avoid a bug in sabre-io/vobject
Signed-off-by: Christian Kraus <hanzi@hanzi.cc>
Diffstat (limited to 'src/services')
-rw-r--r--src/services/updateDesignSet.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/services/updateDesignSet.js b/src/services/updateDesignSet.js
index c97bc18a..0ad08139 100644
--- a/src/services/updateDesignSet.js
+++ b/src/services/updateDesignSet.js
@@ -49,6 +49,24 @@ const setLabelAsSingleValue = () => {
}
/**
+ * Prevents ical.js from adding 'VALUE=PHONE-NUMBER' in vCard 3.0.
+ * While not wrong according to the RFC, there's a bug in sabreio/vobject (used
+ * by Nextcloud Server) that prevents saving vCards with this parameters.
+ *
+ * @link https://github.com/nextcloud/contacts/pull/1393#issuecomment-570945735
+ *
+ * @returns {Boolean} Whether or not the design set has been altered.
+ */
+const removePhoneNumberValueType = () => {
+ if (ICAL.design.vcard3.property.tel) {
+ delete ICAL.design.vcard3.property.tel
+ return true
+ }
+
+ return false
+}
+
+/**
* Some clients group properties by naming them something like 'ITEM1.URL'.
* These should be treated the same as their original (i.e. 'URL' in this
* example), so we iterate through the vCard to find these properties and
@@ -82,6 +100,7 @@ export default function(vCard) {
let madeChanges = false
madeChanges |= setLabelAsSingleValue()
+ madeChanges |= removePhoneNumberValueType()
madeChanges |= addGroupedProperties(vCard)
return madeChanges