cozy / cozy-home-v2

This repository was part of CozyV2 which has been deprecated
https://blog.cozycloud.cc/post/2016/11/21/On-the-road-to-Cozy-version-3
GNU Affero General Public License v3.0
94 stars 53 forks source link

No alarm notification if trigger time is absolute #784

Open clochix opened 8 years ago

clochix commented 8 years ago

Full stack:

[TypeError: Cannot read property '2' of null]
TypeError: Cannot read property '2' of null
    at iCalDurationToUnitValue (/usr/local/cozy/apps/home/node_modules/cozy-home/build/server/models/event.js:73:6)
    at ClassFromGetModel.Event.getAlarms (/usr/local/cozy/apps/home/node_modules/cozy-home/build/server/models/event.js:124:20)
    at AlarmManager.module.exports.AlarmManager.addEventCounters (/usr/local/cozy/apps/home/node_modules/cozy-home/build/server/lib/alarm_manager.js:90:26)
    at /usr/local/cozy/apps/home/node_modules/cozy-home/build/server/lib/alarm_manager.js:46:32
    at /usr/local/cozy/apps/home/node_modules/cozy-home/node_modules/cozydb/lib/model.js:213:18
    at /usr/local/cozy/apps/home/node_modules/cozy-home/node_modules/cozydb/lib/cozymodel.js:294:18
    at parseBody (/usr/local/cozy/apps/home/node_modules/cozy-home/node_modules/cozydb/node_modules/request-json-light/main.js:75:10)
    at IncomingMessage.<anonymous> (/usr/local/cozy/apps/home/node_modules/cozy-home/node_modules/cozydb/node_modules/request-json-light/main.js:109:14)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
clochix commented 8 years ago

This error is triggered when parsing alarms fields of the users events. Here's one of the event that trigger this exception:

    { 
      "id": "e36b487277e6feb25c318fce162bf947",
      "key": "e36b487277e6feb25c318fce162bf947",
      "value": {
        "_id": "e36b487277e6feb25c318fce162bf947",
        "_rev": "1-dc7aa77152a1849a05a5e6ac045ea0e3",
        "start": "2013-09-05T08:00:00.000Z",
        "end": "2013-09-05T09:00:00.000Z",
        "details": "",
        "description": "xxxx",
        "rrule": "",
        "tags": [
          "Cours"
        ],
        "attendees": [],
        "related": null,
        "alarms": [
          { 
            "trigg": "19760401T005545Z",
            "action": "DISPLAY"
          }
        ],
        "created": "2013-06-20T12:53:04.000Z",
        "lastModification": "2013-06-20T12:53:34.000Z",
        "caldavuri": "3CDDC6CB-C755-4D1E-87C1-4F800ADE1549",
        "docType": "event"
      }
    },
clochix commented 8 years ago

Looks like we only handle one of the allowed values for alarm trigger field: https://tools.ietf.org/html/rfc5545#section-3.8.6.3