decode SARIF URIs when filtering diff-informed alerts

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b1744ae3-8204-4901-8dc7-16368fd6d865
This commit is contained in:
akream
2026-10-28 12:06:28 +00:00
parent 166cc10f7e
commit d433dabfd0
4 changed files with 83 additions and 4 deletions

12
lib/entry-points.js generated
View File

@@ -188340,11 +188340,19 @@ function filterAlertsByDiffRange(logger2, sarifLog) {
return locations.some((physicalLocation) => {
const locationUri = physicalLocation?.artifactLocation?.uri;
const locationStartLine = physicalLocation?.region?.startLine;
if (!locationUri || locationStartLine === void 0) {
if (typeof locationUri !== "string" || !locationUri || locationStartLine === void 0) {
return false;
}
let locationPath = locationUri;
try {
locationPath = decodeURIComponent(locationUri);
} catch {
logger2.debug(
`Failed to decode location URI "${locationUri}", comparing it as a raw path`
);
}
return diffRanges.some(
(range2) => range2.path === locationUri && (range2.startLine <= locationStartLine && range2.endLine >= locationStartLine || range2.startLine === 0 && range2.endLine === 0)
(range2) => range2.path === locationPath && (range2.startLine <= locationStartLine && range2.endLine >= locationStartLine || range2.startLine === 0 && range2.endLine === 0)
);
});
});