diff --git a/extensions/ql-vscode/CHANGELOG.md b/extensions/ql-vscode/CHANGELOG.md index 2968a1d20e6..cbd5b9ed593 100644 --- a/extensions/ql-vscode/CHANGELOG.md +++ b/extensions/ql-vscode/CHANGELOG.md @@ -2,6 +2,8 @@ ## [UNRELEASED] +- Sorted result set filenames now include a hash of the result set name instead of the full name. [#2955](https://github.com/github/vscode-codeql/pull/2955) + ## 1.9.2 - 12 October 2023 - Fix a bug where the query to Find Definitions in database source files would not be cancelled appropriately. [#2885](https://github.com/github/vscode-codeql/pull/2885) diff --git a/extensions/ql-vscode/src/run-queries-shared.ts b/extensions/ql-vscode/src/run-queries-shared.ts index e595923c4ce..a63e4c1e698 100644 --- a/extensions/ql-vscode/src/run-queries-shared.ts +++ b/extensions/ql-vscode/src/run-queries-shared.ts @@ -24,6 +24,7 @@ import { BaseLogger, showAndLogWarningMessage } from "./common/logging"; import { extLogger } from "./common/logging/vscode"; import { generateSummarySymbolsFile } from "./log-insights/summary-parser"; import { getErrorMessage } from "./common/helpers-pure"; +import { createHash } from "crypto"; /** * run-queries.ts @@ -150,7 +151,12 @@ export class QueryEvaluationInfo extends QueryOutputDir { }; } getSortedResultSetPath(resultSetName: string) { - return join(this.querySaveDir, `sortedResults-${resultSetName}.bqrs`); + const hasher = createHash("sha256"); + hasher.update(resultSetName); + return join( + this.querySaveDir, + `sortedResults-${hasher.digest("hex")}.bqrs`, + ); } /** diff --git a/extensions/ql-vscode/test/vscode-tests/no-workspace/query-results.test.ts b/extensions/ql-vscode/test/vscode-tests/no-workspace/query-results.test.ts index 9030e063c9b..729cc12be1f 100644 --- a/extensions/ql-vscode/test/vscode-tests/no-workspace/query-results.test.ts +++ b/extensions/ql-vscode/test/vscode-tests/no-workspace/query-results.test.ts @@ -160,7 +160,7 @@ describe("query-results", () => { const expectedResultsPath = join(queryPath, "results.bqrs"); const expectedSortedResultsPath = join( queryPath, - "sortedResults-a-result-set-name.bqrs", + "sortedResults-cc8589f226adc134f87f2438e10075e0667571c72342068e2281e0b3b65e1092.bqrs", ); expect(spy).toBeCalledWith( expectedResultsPath,