From 012a16dc891f0c815dd8429da5bb2c083cdf37e9 Mon Sep 17 00:00:00 2001 From: Riley Chase Date: Tue, 27 May 2025 14:50:20 +0930 Subject: [PATCH 1/2] Add test case to reproduce remote path parse failure --- test/suite/get-tool-url.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/suite/get-tool-url.test.ts b/test/suite/get-tool-url.test.ts index 042aa1dc..533939d4 100644 --- a/test/suite/get-tool-url.test.ts +++ b/test/suite/get-tool-url.test.ts @@ -40,6 +40,14 @@ suite("Get tool URL: gitRemotePath", (): void => { assert.strictEqual(call(func, "1"), "to"); assert.strictEqual(call(func, "2"), "something"); }); + test("org-1234@", (): void => { + const func = gitRemotePath("org-1234@example.com:path/to/something/"); + + assert.strictEqual(call(func), "/path/to/something/"); + assert.strictEqual(call(func, "0"), "path"); + assert.strictEqual(call(func, "1"), "to"); + assert.strictEqual(call(func, "2"), "something"); + }); test("http:// with port", (): void => { const func = gitRemotePath("http://example.com:8080/path/to/something/"); From b3ff3e3a5afc04cf7a46a18f9261080350ba6508 Mon Sep 17 00:00:00 2001 From: Riley Chase Date: Tue, 27 May 2025 14:50:54 +0930 Subject: [PATCH 2/2] Update remote path regex to handle non `git` users --- src/git/util/get-tool-url.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/git/util/get-tool-url.ts b/src/git/util/get-tool-url.ts index 14fb5d47..65619ffe 100644 --- a/src/git/util/get-tool-url.ts +++ b/src/git/util/get-tool-url.ts @@ -53,7 +53,7 @@ const gitOriginHostname = ({ export const gitRemotePath = ( remote: string, ): string | ((index?: string) => string) => { - if (/^[a-z]+?@/.test(remote)) { + if (/^[a-z0-9-]+?@/.test(remote)) { const [, path] = split(remote, ":"); return (index = ""): string => { if (index === "") {