Skip to content

Commit

Permalink
fix(amazonq): incorrect zip entry path for file scans #6741
Browse files Browse the repository at this point in the history
## Problem

Reproduce steps:
1. Open a window with multiple workspace folders, for example
`workspaceFolders: [folder1, folder2]`
2. Open any file and run a code review on the active file, for example
`folder1/sample.py`
3. The zip entry will be created with the workspaceFolder duplicated,
for example `folder1/folder1/sample.py`

## Solution
Explicitly set `includeWorkspaceFolder` to false when getting the
relative path of the file.
  • Loading branch information
ctlai95 authored Mar 10, 2025
1 parent 600ee8f commit 0ed2a3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "/review: Zip files are created with the wrong file path for file scans in multifolder workspaces."
}
3 changes: 2 additions & 1 deletion packages/core/src/codewhisperer/util/zipUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ export class ZipUtil {
// Note: workspaceFolder.name is not the same as the file system folder name,
// use the fsPath value instead
const projectName = path.basename(workspaceFolder.uri.fsPath)
const relativePath = vscode.workspace.asRelativePath(uri)
// Set includeWorkspaceFolder to false because we are already manually prepending the projectName
const relativePath = vscode.workspace.asRelativePath(uri, false)
const zipEntryPath = this.getZipEntryPath(projectName, relativePath)
zip.addFile(zipEntryPath, Buffer.from(content, 'utf-8'))

Expand Down

0 comments on commit 0ed2a3a

Please sign in to comment.