node-imapnotify icon indicating copy to clipboard operation
node-imapnotify copied to clipboard

Crash on empty config entry

Open josswright opened this issue 8 years ago • 1 comments

I just installed this, and created a JSON config file as mentioned in the README.

As I had no need for an 'onNotifyPost' entry, I initially left it empty: exports.onNotifyPost = "";

That crashed with:

/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:31
content = str.slice(lastIndex);
               ^
TypeError: Cannot read property 'slice' of undefined
at tokenize (/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:31:16)
at new Formatter (/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:41:18)
at module.exports (/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:459:19)
at notify (/usr/lib/node_modules/imapnotify/bin/imapnotify:241:21)
at Connection.<anonymous> (/usr/lib/node_modules/imapnotify/bin/imapnotify:66:11)
at emitOne (events.js:96:13)
at Connection.emit (events.js:191:7)
at Connection._resUntagged (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Connection.js:1287:14)
at Parser.<anonymous> (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Connection.js:191:10)
at emitOne (events.js:96:13)`

The same happened if I simply commented that line out of the config.

I've currently fixed it simply by putting /usr/bin/true in the onNotifyPost export, but this should probably be handled!

josswright avatar May 30 '17 17:05 josswright

Thank you for reporting the issue. I don't really have time right now to fix the issue, but patches are welcome.

a-sk avatar Jun 19 '17 06:06 a-sk