sindresorhus / open

Open stuff like URLs, files, executables. Cross-platform.
MIT License
3.18k stars 219 forks source link

Escape quotes in arguments for PowerShell #319

Open ChristianLW opened 1 year ago

ChristianLW commented 1 year ago

A fix for #318. This is just a simple patch and can of course be changed if necessary.

The String.prototype.replaceAll.call(arg, ...) instead of just arg.replaceAll(...) is because appArguments might contain things other than strings.

This doesn't add escaping to the app name itself.

I'm not sure if you want to set up a unit test for this scenario, and I'm not sure if this change marks a breaking API change (if some people already put ` in their strings even though that wouldn't work on other platforms).