Skip to content

Commit 5dfe7c5

Browse files
authored
Merge pull request #189 from Nadock/fix-enterprise-org-remote-url
Update remote URL parsing to support non-`git` ssh user
2 parents a4cfe9c + b3ff3e3 commit 5dfe7c5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/git/util/get-tool-url.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const gitOriginHostname = ({
5353
export const gitRemotePath = (
5454
remote: string,
5555
): string | ((index?: string) => string) => {
56-
if (/^[a-z]+?@/.test(remote)) {
56+
if (/^[a-z0-9-]+?@/.test(remote)) {
5757
const [, path] = split(remote, ":");
5858
return (index = ""): string => {
5959
if (index === "") {

test/suite/get-tool-url.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ suite("Get tool URL: gitRemotePath", (): void => {
4040
assert.strictEqual(call(func, "1"), "to");
4141
assert.strictEqual(call(func, "2"), "something");
4242
});
43+
test("org-1234@", (): void => {
44+
const func = gitRemotePath("org-1234@example.com:path/to/something/");
45+
46+
assert.strictEqual(call(func), "/path/to/something/");
47+
assert.strictEqual(call(func, "0"), "path");
48+
assert.strictEqual(call(func, "1"), "to");
49+
assert.strictEqual(call(func, "2"), "something");
50+
});
4351
test("http:// with port", (): void => {
4452
const func = gitRemotePath("http://example.com:8080/path/to/something/");
4553

0 commit comments

Comments
 (0)