提交 ff1b513f 编写于 作者: P Pine Wu

Fix #96638

上级 84fc970a
......@@ -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']);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册