Merge pull request #3018 from github/koesie10/fix-empty-location
Fix empty message with empty SARIF path
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
- Fix a bug where the "View Query Log" action for a query history item was not working. [#2984](https://github.com/github/vscode-codeql/pull/2984)
|
||||
- Add a command to sort items in the databases view by language. [#2993](https://github.com/github/vscode-codeql/pull/2993)
|
||||
- Fix not being able to open the results directory or evaluator log for a cancelled local query run. [#2996](https://github.com/github/vscode-codeql/pull/2996)
|
||||
- Fix empty row in alert path when the SARIF location was empty. [#3018](https://github.com/github/vscode-codeql/pull/3018)
|
||||
|
||||
## 1.9.2 - 12 October 2023
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as Sarif from "sarif";
|
||||
import type { HighlightedRegion } from "../variant-analysis/shared/analysis-result";
|
||||
import { ResolvableLocationValue } from "../common/bqrs-cli-types";
|
||||
import { isEmptyPath } from "./bqrs-utils";
|
||||
|
||||
export interface SarifLink {
|
||||
dest: number;
|
||||
@@ -111,6 +112,9 @@ export function parseSarifLocation(
|
||||
return { hint: "no artifact location" };
|
||||
if (physicalLocation.artifactLocation.uri === undefined)
|
||||
return { hint: "artifact location has no uri" };
|
||||
if (isEmptyPath(physicalLocation.artifactLocation.uri)) {
|
||||
return { hint: "artifact location has empty uri" };
|
||||
}
|
||||
|
||||
// This is not necessarily really an absolute uri; it could either be a
|
||||
// file uri or a relative uri.
|
||||
|
||||
@@ -389,6 +389,22 @@ WithCodeFlows.args = {
|
||||
message: { text: "id : String" },
|
||||
},
|
||||
},
|
||||
{
|
||||
location: {
|
||||
physicalLocation: {
|
||||
artifactLocation: {
|
||||
uri: "file:/",
|
||||
index: 5,
|
||||
},
|
||||
region: {
|
||||
startLine: 13,
|
||||
startColumn: 25,
|
||||
endColumn: 54,
|
||||
},
|
||||
},
|
||||
message: { text: "id : String" },
|
||||
},
|
||||
},
|
||||
{
|
||||
location: {
|
||||
physicalLocation: {
|
||||
|
||||
@@ -76,6 +76,36 @@ describe("parsing sarif", () => {
|
||||
).toEqual({
|
||||
hint: "artifact location has no uri",
|
||||
});
|
||||
expect(
|
||||
parseSarifLocation(
|
||||
{
|
||||
physicalLocation: {
|
||||
artifactLocation: {
|
||||
uri: "",
|
||||
index: 5,
|
||||
},
|
||||
},
|
||||
},
|
||||
"",
|
||||
),
|
||||
).toEqual({
|
||||
hint: "artifact location has empty uri",
|
||||
});
|
||||
expect(
|
||||
parseSarifLocation(
|
||||
{
|
||||
physicalLocation: {
|
||||
artifactLocation: {
|
||||
uri: "file:/",
|
||||
index: 5,
|
||||
},
|
||||
},
|
||||
},
|
||||
"",
|
||||
),
|
||||
).toEqual({
|
||||
hint: "artifact location has empty uri",
|
||||
});
|
||||
});
|
||||
|
||||
it("should parse a sarif location with no region and no file protocol", () => {
|
||||
|
||||
Reference in New Issue
Block a user