From 5f96d95ab4310ff5291629862874086fb1fe7bf8 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 3 Apr 2022 13:52:37 -0300 Subject: [PATCH] Add additional validation to find the app-specific argument we require (#687 #689) --- app/src/main-process/main.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main-process/main.ts b/app/src/main-process/main.ts index 114480145f1..3c2e290eabb 100644 --- a/app/src/main-process/main.ts +++ b/app/src/main-process/main.ts @@ -269,6 +269,16 @@ function handlePossibleProtocolLauncherArgs(args: ReadonlyArray) { } else { log.error(`Malformed launch arguments received: ${args}`) } + } else if (__LINUX__) { + // we expect this call to have several parameters before the URL we want, + // so we should filter out the program name as well as any parameters that + // look like arguments to Electron + const argsWithoutParameters = args.filter( + a => !a.endsWith('github-desktop') && !a.startsWith('--') + ) + if (argsWithoutParameters.length > 0) { + handleAppURL(argsWithoutParameters[0]) + } } else if (args.length > 1) { handleAppURL(args[1]) }