Parse uri= simplified format for open-issue-webview links#8775
Open
Copilot wants to merge 2 commits into
Open
Conversation
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix hyperlink issue for issue number in chat
Parse uri= simplified format for open-issue-webview links
Jun 8, 2026
alexr00
approved these changes
Jun 9, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the extension’s URI parsing so that “open issue” links emitted by VS Code chat using the simplified ?uri=… query format are correctly recognized, instead of being silently dropped by the URI handler.
Changes:
- Extend
fromOpenIssueWebviewUrito parse the simplifieduri=https?://github.com/<owner>/<repo>/issues/<n>query format, with strict URL validation, and fall back to the legacy JSON query format. - Add unit tests covering the new simplified format, legacy JSON fallback, and multiple invalid-input cases.
Show a summary per file
| File | Description |
|---|---|
src/common/uri.ts |
Adds simplified uri= query parsing for issue-webview links before falling back to legacy JSON parsing. |
src/test/common/uri.test.ts |
Adds coverage for simplified-format issue URIs and validation/compatibility cases. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/common/uri.ts:729
- In the legacy JSON fallback,
JSON.parsereturnsany, soissueNumbermight be a string (or other non-integer) even ifvalidateOpenWebviewParamspasses. Returningquerydirectly can leak an unexpected type into downstream code that assumesissueNumber: number(e.g.uriHandler.tspasses it asidentity.number). Coerce and validateissueNumberas a safe integer before returning, and return a strongly-typed object.
const query = JSON.parse(uri.query.split('&')[0]);
if (!validateOpenWebviewParams(query.owner, query.repo, query.issueNumber)) {
return;
}
return query;
- Files reviewed: 2/2 changed files
- Comments generated: 0
benibenj
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue links emitted by VS Code chat (via microsoft/vscode#320404) use a simplified
?uri=…query, e.g.fromOpenIssueWebviewUrionly understood the legacy JSON-encoded query and returnedundefined, so the URI handler silently dropped the click.Changes
src/common/uri.ts–fromOpenIssueWebviewUrinow first attempts to parse auri=https?://github.com/<owner>/<repo>/issues/<n>query parameter (anchored regex rejects extra path segments and non-numeric numbers), then falls back to the legacy JSON format. Mirrors the existingfromOpenOrCheckoutPullRequestWebviewUrishape.src/test/common/uri.test.ts– Adds coverage for the new format, http variant, JSON fallback, invalid authority/path/host, non-numeric numbers, and trailing path segments.