Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/lib/arg-parsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,10 +955,11 @@ function parseWithHash(arg: string): ParsedIssueArg {
return parseBareIssueIdentifier(fragment);
}

// `org/project#SHORTID` → equivalent to `org/project/SHORTID`. Reconstruct the
// slash form so parseWithSlash/parseMultiSlashIssueArg handle org/project
// validation and the short-ID prefix-match logic.
// `org/project#SHORTID` → equivalent to `org/project/SHORTID`. Validate the
// org/project prefix components first — the `#` path skips the main
// validateResourceId guard, and parseWithSlash doesn't re-validate.
if (prefix.includes("/")) {
validateResourceId(prefix.replace(/\//g, ""), "issue identifier");
return parseWithSlash(`${prefix}/${fragment}`);
}

Expand Down
5 changes: 5 additions & 0 deletions test/lib/arg-parsing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,11 @@ describe("parseIssueArg: GitHub-style # separator (CLI-1G1)", () => {
expect(() => parseIssueArg("bad%proj#G")).toThrow(ValidationError);
});

test("forbidden characters in org/project prefix throw", () => {
expect(() => parseIssueArg("bad%org/project#G")).toThrow(ValidationError);
expect(() => parseIssueArg("org/bad%proj#G")).toThrow(ValidationError);
});

test("multiple # error message suggests the correct format", () => {
expect(() => parseIssueArg("a#b#c")).toThrow(/org\/project#PROJ-123/);
});
Expand Down
Loading