mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 11:16:39 +00:00
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:
parent
7e0f54e7d6
commit
be8f4bfce7
@ -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',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user