microsoft / microsoft/vscode

GitHub Copilot chat web request confirmation dialog does not correctly linkify URLs with spaces

Open
#329,183 0 comments 0 reactions 1 assignee Claimed by @justschen View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

In the security dialog to confirm access to URLs, the clickable link to show to the user only encompasses part of the link if the link has spaces.

1. Ask the LLM to research foo bar libraries.
2. In the VS Code Copilot chat window, the LLM tries to fetch `https://registry.npmjs.org/-/v1/search?text=foo bar&size=20`.
3. A dialog appears showing the URL the LLM wants to fetch. The link is clickable.

**Expected:** The clickable link looks like this:

> Fetch web pages?
> * [https://registry.npmjs.org/-/v1/search?text=foo bar&size=20](https://registry.npmjs.org/-/v1/search?text=foo%20bar&size=20)

**Actual:** Only part of the link was recognized:

> Fetch web pages?
> * [https://registry.npmjs.org/-/v1/search?text=foo](https://registry.npmjs.org/-/v1/search?text=foo) bar&size=20

**Discussion:** My best guess is that somewhere in the logic of GitHub Copilot, the link received from the LLM is in a form that isn't completely URI-encoded. The logic neglects to URI-encode the URL (in this case, converting ` ` to `%20`.) Instead, it immediately tries to scan a token without whitespace, or searches for the first whitespace, etc.

Somewhere there is a line of code that says:

1. Get URL from LLM.
2. `encodeUri(urlFromLlm)` <-- missing step; would yield `https://registry.npmjs.org/-/v1/search?text=foo%20bar&size=20`

My assumption here is that the LLM is supplying a URL as the user would type in a browser; still, I'll bet the URL is still delimited so that its end is unambiguous. Thus the solution would be to use a similar algorithm that a browser would use to encode a user-entered URL before using it.

```
Version: 1.132.0 (user setup)
Commit: df53daabb18cd157bdb08c7f01c34df936cf12f4
Date: 2026-08-04T15:30:20Z
Electron: 42.7.1
ElectronBuildId: 14760073
Chromium: 148.0.7778.280
Node.js: 24.18.0
V8: 14.8.178.38-electron.0
OS: Windows_NT x64 10.0.26200
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.