From f5c3aa4b58dafdf360d9f553138e5435639dc718 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 070663f9961..6ee34e18592 100644 --- a/app/src/main-process/main.ts +++ b/app/src/main-process/main.ts @@ -273,6 +273,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]) }