File tree 3 files changed +31
-1
lines changed
3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -566,4 +566,9 @@ export default class Contact {
566
566
}
567
567
}
568
568
569
+ toStringStripQuotes ( ) {
570
+ const regexp = / T Y P E = " ( [ a - z A - Z - ,] + ) " / gm
571
+ const card = this . vCard . toString ( )
572
+ return card . replaceAll ( regexp , 'TYPE=$1' )
573
+ }
569
574
}
Original file line number Diff line number Diff line change @@ -63,6 +63,30 @@ const addGroupedProperties = vCard => {
63
63
return madeChanges
64
64
}
65
65
66
+ /**
67
+ * Fixes misbehaviour with TYPE quotes and separated commas
68
+ * Seems to have been introduced with https://github.com/mozilla-comm/ical.js/pull/387
69
+ *
70
+ * @returns {Boolean } Whether or not the design set has been altered.
71
+ */
72
+ const setTypeMultiValueSeparateDQuote = ( ) => {
73
+ if (
74
+ ! ICAL . design . vcard . param . type
75
+ || ICAL . design . vcard . param . type . multiValueSeparateDQuote !== false
76
+ || ! ICAL . design . vcard3 . param . type
77
+ || ICAL . design . vcard3 . param . type . multiValueSeparateDQuote !== false
78
+ ) {
79
+ // https://github.com/mozilla-comm/ical.js/blob/ba8e2522ffd30ffbe65197a96a487689d6e6e9a1/lib/ical/stringify.js#L121
80
+ ICAL . design . vcard . param . type . multiValueSeparateDQuote = false
81
+ ICAL . design . vcard3 . param . type . multiValueSeparateDQuote = false
82
+
83
+ return true
84
+ }
85
+
86
+ return false
87
+ }
88
+
89
+ /**
66
90
/**
67
91
* Check whether the ical.js design sets need updating (and if so, do it)
68
92
*
@@ -72,6 +96,7 @@ const addGroupedProperties = vCard => {
72
96
export default function ( vCard ) {
73
97
let madeChanges = false
74
98
99
+ madeChanges |= setTypeMultiValueSeparateDQuote ( )
75
100
madeChanges |= removePhoneNumberValueType ( )
76
101
madeChanges |= addGroupedProperties ( vCard )
77
102
Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ const actions = {
353
353
rev . fromUnixTime ( Date . now ( ) / 1000 )
354
354
contact . rev = rev
355
355
356
- const vData = contact . vCard . toString ( )
356
+ const vData = contact . toStringStripQuotes ( )
357
357
358
358
// if no dav key, contact does not exists on server
359
359
if ( ! contact . dav ) {
You can’t perform that action at this time.
0 commit comments