Skip to content

Commit 8eb4b26

Browse files
authored
fix: allow / in git refs (#102)
1 parent 5ea5d96 commit 8eb4b26

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ describe("parseGitURI", () => {
66
const tests = [
77
{ input: "org/repo", output: {} },
88
{ input: "org/repo#ref", output: { ref: "ref" } },
9+
{ input: "org/repo#ref-123", output: { ref: "ref-123" } },
10+
{ input: "org/repo#ref/ABC-123", output: { ref: "ref/ABC-123" } },
911
{ input: "org/repo/foo/bar", output: { subdir: "/foo/bar" } },
1012
];
1113

0 commit comments

Comments
 (0)