From d289d92b19f82c4e653ed0beae2ec10a6a7f6ed5 Mon Sep 17 00:00:00 2001 From: Carter McKendry Date: Sat, 29 Aug 2020 18:19:06 -0400 Subject: [PATCH] Escape file names that contain "&" characters Currently the child process exits with a code 127 when attempting to transfer any files that contain a "&" character. The fix is a trivial change to the file.replace regex. --- rsync.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rsync.js b/rsync.js index a8a7d73..e9dad90 100644 --- a/rsync.js +++ b/rsync.js @@ -1017,7 +1017,7 @@ function escapeShellArg(arg) { * @return {String} the escaped version of the filename */ function escapeFileArg(filename) { - filename = filename.replace(/(["'`\s\\\(\)\\$])/g,'\\$1'); + filename = filename.replace(/(["'`\s\\\(\)\\$\&])/g,'\\$1'); if (!/(\\\\)/.test(filename)) { return filename; }