mirror of
https://github.com/github/codeql-action.git
synced 2026-11-09 06:29:52 +00:00
fix: decode SARIF location URIs in diff-informed alert filtering
This commit is contained in:
12
lib/entry-points.js
generated
12
lib/entry-points.js
generated
@@ -188534,11 +188534,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 decodedLocationUri = locationUri;
|
||||
try {
|
||||
decodedLocationUri = 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 === decodedLocationUri || range2.path === locationUri) && (range2.startLine <= locationStartLine && range2.endLine >= locationStartLine || range2.startLine === 0 && range2.endLine === 0)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user