Skip to content

Crash on empty config entry #15

Description

@josswright

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions