mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 16:58:55 -05:00
Fix #96638
This commit is contained in:
@@ -222,6 +222,10 @@ function pathMatches(open: string, rule: string) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rule[rule.length - 1] === '/') {
|
||||
rule = rule.slice(0, -1);
|
||||
}
|
||||
|
||||
const openSegments = open.split('/');
|
||||
const ruleSegments = rule.split('/');
|
||||
for (let i = 0; i < ruleSegments.length; i++) {
|
||||
|
||||
@@ -56,6 +56,11 @@ suite('Link protection domain matching', () => {
|
||||
|
||||
test('sub paths', () => {
|
||||
linkAllowedByRules('https://x.org/foo', ['https://x.org/foo']);
|
||||
linkAllowedByRules('https://x.org/foo/bar', ['https://x.org/foo']);
|
||||
|
||||
linkAllowedByRules('https://x.org/foo', ['https://x.org/foo/']);
|
||||
linkAllowedByRules('https://x.org/foo/bar', ['https://x.org/foo/']);
|
||||
|
||||
linkAllowedByRules('https://x.org/foo', ['x.org/foo']);
|
||||
linkAllowedByRules('https://x.org/foo', ['*.org/foo']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user