From 42f76b79aa0bb188ec4a9c051cdd0a8b202da1e3 Mon Sep 17 00:00:00 2001 From: Kylie C Date: Fri, 16 Aug 2024 11:08:27 -0400 Subject: [PATCH] update uri matching attempt to cover malformed or incomplete uris Use RegExp to avoid escape character hell --- src/main/mainWindow.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index bf462e5..4ff7e8c 100644 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -460,7 +460,7 @@ function createMainWindow() { const uri = process.argv.find(arg => arg.startsWith("discord://")); const loadUrl = (url: string | undefined) => { - win.loadURL(`https://${subdomain}discord.com${url?.substring("discord://".length) || "/app"}`); + win.loadURL(`https://${subdomain}discord.com/${url?.replace(RegExp("^discord://[^/]*/?"), "") || "app"}`); }; let uriFiredDarwin = false;