Fix assistant file links with line suffixes

This commit is contained in:
Mohamed Boudra
2026-04-24 11:32:16 +07:00
parent 446dd9cfe6
commit d118e2349e
2 changed files with 41 additions and 0 deletions
+15
View File
@@ -166,6 +166,21 @@ export function parseAssistantFileLink(
return null;
}
const inlinePathTarget = parseInlinePathToken(trimmed);
if (inlinePathTarget) {
const normalizedPath = normalizePathToken(inlinePathTarget.path);
if (
normalizedPath &&
isAbsolutePath(normalizedPath) &&
isAllowedAbsolutePath(normalizedPath, options.workspaceRoot)
) {
return {
...inlinePathTarget,
path: normalizedPath,
};
}
}
const windowsPathMatch = trimmed.match(/^([A-Za-z]:[\\/][^?#]*)(#[^?]+)?$/);
if (windowsPathMatch) {
const normalizedPath = normalizePathToken(windowsPathMatch[1] ?? "");