diff options
author | Christian Kraus <hanzi@hanzi.cc> | 2020-01-06 12:41:35 +0100 |
---|---|---|
committer | Christian Kraus <hanzi@hanzi.cc> | 2020-01-06 12:41:35 +0100 |
commit | b9f63e63dab323ca4fb058b74960da7265415b76 (patch) | |
tree | f890cf0e9820c90b6edfc39e878d3a9c929dc5ff /src | |
parent | 16001ab488bbf0464c665a9d093f5c0d7f97eec2 (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')
-rw-r--r-- | src/services/updateDesignSet.js | 19 |
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 |