mikaelbr / node-notifier

A Node.js module for sending notifications on native Mac, Windows and Linux (or Growl as fallback)
MIT License
5.75k stars 322 forks source link

Node-notifier doesn't escape parameters passed to notify-send command, resulting in error #319

Open laurent22 opened 4 years ago

laurent22 commented 4 years ago

For this alert:

{id":17,"date":"2020-03-20T13:01:00.325Z","title":"just dash as first character","body":"-\n\nmore text"}"

We are getting this error:

Error: Command failed: notify-send "just dash as first character" "-\n\nmore text" --icon "/tmp/.mount_Joplinu3xj3u/resources/build/icons/512x512.png" Unknown option -\n\nmore text

So it seems node-notified is not escaping the parameters passed to the notify-send command. I guess just wrapping in single quotes (instead of double) would work?

Or if not, the first dashes could probably be trimmed, which would be better than throwing an error.