cozy / cozy-vcard

Cozy-vcard provides vcard Parser and Objects
Other
29 stars 17 forks source link

TypeError: Cannot read property 'indexOf' of null #25

Closed clochix closed 6 years ago

clochix commented 7 years ago

Seen in the logs of Sync:

/usr/local/cozy/apps/sync/node_modules/cozy-vcard/lib/index.js:740
    } else if (type.indexOf('PHONETIC') === 0) {
                   ^

TypeError: Cannot read property 'indexOf' of null
    at exportAbout (/usr/local/cozy/apps/sync/node_modules/cozy-vcard/lib/index.js:740:20)
    at Function.VCardParser.toVCF (/usr/local/cozy/apps/sync/node_modules/cozy-vcard/lib/index.js:625:25)
    at Writable.<anonymous> (/usr/local/cozy/apps/sync/build/server/models/contact.js:127:43)
    at emitNone (events.js:72:20)
    at Writable.emit (events.js:166:7)
    at finishMaybe (_stream_writable.js:482:14)
    at endWritable (_stream_writable.js:492:3)
    at Writable.end (_stream_writable.js:457:5)
    at IncomingMessage.onend (_stream_readable.js:498:10)
    at IncomingMessage.g (events.js:260:16)
clochix commented 7 years ago

A contact has two datapoints without type, which make the application crash when exporting it to vcard:

  "datapoints": [
    {
      "name": "about",
      "value": "2013-04-14"
    },
    {
      "name": "about",
      "value": "2013-04-14"
    },
    {
      "name": "email",
      "value": "xxxxxx",
      "type": "home"
    }
  ],