Skip to content

Commit 8128e33

Browse files
authored
fix(parseGitURI): support @ symbol in ref segment (#153)
1 parent a61d394 commit 8128e33

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/_utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export async function download(
4646
}
4747

4848
const inputRegex =
49-
/^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./-]+)?/;
49+
/^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;
5050

5151
export function parseGitURI(input: string): GitInfo {
5252
const m = input.match(inputRegex)?.groups || {};

test/utils.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ describe("parseGitURI", () => {
88
{ input: "org/repo#ref", output: { ref: "ref" } },
99
{ input: "org/repo#ref-123", output: { ref: "ref-123" } },
1010
{ input: "org/repo#ref/ABC-123", output: { ref: "ref/ABC-123" } },
11+
{ input: "org/repo#@org/[email protected]", output: { ref: "@org/[email protected]" } },
1112
{ input: "org/repo/foo/bar", output: { subdir: "/foo/bar" } },
1213
];
1314

0 commit comments

Comments
 (0)