Skip to content

Commit 131005d

Browse files
authored
fix(amazonq): incorrect path for diff on windows (#6740)
## Problem Diff path is incorrect when running a scan from windows. The code scan service expects diff paths in UNIX format. ## Solution Replace all `\` with `/` --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent f752c1a commit 131005d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "/review: Invalid file path characters caused some detections to be skipped on Windows"
4+
}

packages/core/src/codewhisperer/util/zipUtil.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { FeatureUseCase } from '../models/constants'
2424
import { ChildProcess, ChildProcessOptions } from '../../shared/utilities/processUtils'
2525
import { ProjectZipError } from '../../amazonqTest/error'
2626
import { removeAnsi } from '../../shared/utilities/textUtilities'
27+
import { normalize } from '../../shared/utilities/pathUtils'
2728

2829
export interface ZipMetadata {
2930
rootDir: string
@@ -123,7 +124,7 @@ export class ZipUtil {
123124
zip.addFile(zipEntryPath, Buffer.from(content, 'utf-8'))
124125

125126
if (scope === CodeWhispererConstants.CodeAnalysisScope.FILE_ON_DEMAND) {
126-
const gitDiffContent = `+++ b/${path.normalize(zipEntryPath)}` // Sending file path in payload for LLM code review
127+
const gitDiffContent = `+++ b/${normalize(zipEntryPath)}` // Sending file path in payload for LLM code review
127128
zip.addFile(ZipConstants.codeDiffFilePath, Buffer.from(gitDiffContent, 'utf-8'))
128129
}
129130
} else {

0 commit comments

Comments
 (0)