mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 05:06:16 -08:00
fix(agents): restrict opaque URI exemptions to parsed links
This commit is contained in:
1 parent
8d798e050b
commit
71b7204ca0
3 files changed
+26
-2
No files matched your search
@@ -145,9 +145,22 @@ export function guidanceProse(markdown) {
|
||||
)
|
||||
)
|
||||
return ' ';
|
||||
if (node.tagName === 'a') {
|
||||
const href = node.attrs?.find(
|
||||
(attribute) => attribute.name === 'href'
|
||||
)?.value;
|
||||
if (
|
||||
href &&
|
||||
/^[a-z][a-z\d+.-]*:(?!\/\/)/iu.test(href) &&
|
||||
node.childNodes?.length === 1 &&
|
||||
node.childNodes[0].nodeName === '#text' &&
|
||||
node.childNodes[0].value === href
|
||||
)
|
||||
return ' ';
|
||||
}
|
||||
if (node.nodeName === '#text')
|
||||
return node.value.replace(
|
||||
/(?:(?<![@/\p{L}\p{N}_])[a-z][a-z\d+.-]*:(?![@\s])|\/\/)[^\s]*?(?=[)\]}>][.,;:!?]*@|\s|$)/giu,
|
||||
/(?:\b[a-z][a-z\d+.-]*:\/\/|\/\/)[^\s]*?(?=[)\]}>][.,;:!?]*@|\s|$)/giu,
|
||||
' '
|
||||
);
|
||||
const content = (node.childNodes ?? []).map(text).join('');
|
||||
|
||||
@@ -1522,3 +1522,13 @@ test('colon directly before an import remains checked', async (t) => {
|
||||
).some((message) => message.includes('additional or inline'))
|
||||
);
|
||||
});
|
||||
|
||||
test('colon-labeled prose cannot hide imports', async (t) => {
|
||||
assert.ok(
|
||||
(
|
||||
await diagnostics(t, {
|
||||
'CLAUDE.md': '@AGENTS.md\n\nFallback:then;@docs/guide.md',
|
||||
})
|
||||
).some((message) => message.includes('additional or inline'))
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user