fix(GUI): escape quotes from image paths (#598)

Consider a directory name such as `Juan's Files`. When passing such path
as an argument to the child writer proxy script, Bash will complain
with:

> Unexpected EOF while looking for matching `'`

The solution is to manually escape quotes on the image path.

Change-Type: patch
Changelog-Entry: Escape quotes from image paths to prevent Bash errors on GNU/Linux and OS X.
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This commit is contained in:
Juan Cruz Viotti 2016-07-26 08:50:58 -04:00 committed by GitHub
parent 7e0f54e7d6
commit be8f4bfce7

View File

@ -81,11 +81,10 @@ exports.getCLIWriterArguments = (options) => {
return options.image; return options.image;
} }
// Parenthesis need to be manually escaped, // Parenthesis and quotes need to be manually escaped, otherwise
// otherwise bash will complain about syntax // bash will complain about syntax errors when passing this
// errors when passing this string as an // string as an argument to the writer proxy script.
// argument to the writer proxy script. return options.image.replace(/([\(\)'"])/g, '\\$1');
return options.image.replace(/([\(\)])/g, '\\$1');
}), }),
'--robot', '--robot',