tomas / dialog

Show native alert dialogs on Windows, OSX and Linux with Node.js.
57 stars 16 forks source link

Quotes in the message in windows #8

Closed NiklasGollenstede closed 6 years ago

NiklasGollenstede commented 7 years ago

Having a " in the message causes the .vbs script to throw. Here is a simple demo: node -e "(function test() { console.log('running\n', test.toString(), '\n'); require('dialog').info('\"message', 'title', function(code, out, err) { if (err) console.log('Error:', err); }); })()" Removing the \" fixes the problem. As a general countermeasure, I'd suggest to use .replace(/"/g, "''") (replace double quotes with two single quotes) for all stings passed to the VBScript in windows.

tomas commented 7 years ago

Yikes, good catch. I'll fix this right now.

FireController1847 commented 6 years ago

right now. > Days, months, then years pass...

NiklasGollenstede commented 6 years ago

It is already in the code: fb42ebefa94aacad049c2f35e7a948806031abe4

I would have used two single quotes for every double quote, though. .replace(/"/g, "''"), as they are rendered the same.