diff --git a/src/services/updateDesignSet.js b/src/services/updateDesignSet.js index c97bc18a8..0ad081394 100644 --- a/src/services/updateDesignSet.js +++ b/src/services/updateDesignSet.js @@ -48,6 +48,24 @@ const setLabelAsSingleValue = () => { return false } +/** + * 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 @@ -82,6 +100,7 @@ export default function(vCard) { let madeChanges = false madeChanges |= setLabelAsSingleValue() + madeChanges |= removePhoneNumberValueType() madeChanges |= addGroupedProperties(vCard) return madeChanges