Skip to content

Commit a8420f7

Browse files
Fix bad handling of trusted domains with no scheme (microsoft#249858)
Fix microsoft#249353 Agent mode fixed this one entirely 🚀
1 parent 4ae4068 commit a8420f7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/vs/workbench/contrib/url/common/urlGlob.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function normalizeURL(url: string | URI): URI {
3030
*/
3131
export function testUrlMatchesGlob(uri: string | URI, globUrl: string): boolean {
3232
const normalizedUrl = normalizeURL(uri);
33-
let normalizedGlobUrl = normalizeURL(globUrl);
33+
let normalizedGlobUrl: URI;
3434

3535
const globHasScheme = /^[^./:]*:\/\//.test(globUrl);
3636
// if the glob does not have a scheme we assume the scheme is http or https
@@ -40,6 +40,8 @@ export function testUrlMatchesGlob(uri: string | URI, globUrl: string): boolean
4040
return false;
4141
}
4242
normalizedGlobUrl = normalizeURL(`${normalizedUrl.scheme}://${globUrl}`);
43+
} else {
44+
normalizedGlobUrl = normalizeURL(globUrl);
4345
}
4446

4547
return (

src/vs/workbench/contrib/url/test/browser/trustedDomains.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ suite('Link protection domain matching', () => {
4949
linkAllowedByRules('https://a.x.org', ['*.x.org']);
5050
linkAllowedByRules('https://a.b.x.org', ['*.x.org']);
5151
linkAllowedByRules('https://x.org', ['*.x.org']);
52+
// https://github.com/microsoft/vscode/issues/249353
53+
linkAllowedByRules('https://x.org:3000', ['*.x.org:3000']);
5254
});
5355

5456
test('sub paths', () => {

0 commit comments

Comments
 (0)