From be7432857757bbe485109a581ec3486619f237be Mon Sep 17 00:00:00 2001 From: Lawrence Cheung Date: Wed, 14 Oct 2020 16:37:24 -0700 Subject: [PATCH 1/4] Fix issue with spaces in the app name --- sign.js | 1 + 1 file changed, 1 insertion(+) diff --git a/sign.js b/sign.js index 41060fc..fc8411a 100644 --- a/sign.js +++ b/sign.js @@ -287,6 +287,7 @@ var signAsync = module.exports.signAsync = function (opts) { .then(function () { // Determine identity for signing var promise + opts.app.replace(' ', '\ ') if (opts.identity) { debuglog('`identity` passed in arguments.') if (opts['identity-validation'] === false) { From 120a86d63e7d8041c8bfd4a046fa0de4de1be044 Mon Sep 17 00:00:00 2001 From: Lawrence Cheung Date: Wed, 14 Oct 2020 17:39:14 -0700 Subject: [PATCH 2/4] Fix the js standard style error --- sign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sign.js b/sign.js index fc8411a..e033553 100644 --- a/sign.js +++ b/sign.js @@ -287,7 +287,7 @@ var signAsync = module.exports.signAsync = function (opts) { .then(function () { // Determine identity for signing var promise - opts.app.replace(' ', '\ ') + opts.app.replace(' ', '\\ ') if (opts.identity) { debuglog('`identity` passed in arguments.') if (opts['identity-validation'] === false) { From 582ba0691853dc6c6580dd4e3a1a8a6a54e2e8bc Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Sat, 19 Feb 2022 21:34:24 -0800 Subject: [PATCH 3/4] throw an error if app contains a space without an escape character in validateOptsApp --- src/util.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util.ts b/src/util.ts index 9a7e5c4..a81afe4 100644 --- a/src/util.ts +++ b/src/util.ts @@ -107,6 +107,10 @@ export async function validateOptsApp (opts: BaseSignOptions): Promise { if (!(await fs.pathExists(opts.app))) { throw new Error(`Application at path "${opts.app}" could not be found`); } + const pathWithSpaceEscapeChars = opts.app.replace(/(\s+)/g, '\\$1'); + if (opts.app !== pathWithSpaceEscapeChars) { + throw new Error(`Application name "${opts.app}" with space is not supported.`); + } } /** From 2314c6716ada46263b1bd504070a14150d7f8f7b Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Sat, 19 Feb 2022 21:36:11 -0800 Subject: [PATCH 4/4] Add note to the README regarding the app argument with app name with spaces --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 12e945f..62fffb8 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ signAsync({ `app` - *String* Path to the application package. -Needs file extension `.app`. +Needs file extension `.app`. NOTE: if your app name contains the space character, please rename the .app and the binary in `.app/Contents/MacOS/` without the space character; otherwise, it will throw an error. **Optional**