Skip to content

Commit 1be9ad0

Browse files
committed
fix(amazonq): always use projectName in zipEntryPath
1 parent 5f76b56 commit 1be9ad0

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
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": "Code Review: Fixed a bug where projects with nested folder names did not scan properly."
4+
}

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,8 @@ export class ZipUtil {
141141
return zipFilePath
142142
}
143143

144-
protected getZipEntryPath(projectName: string, relativePath: string, useCase?: ZipUseCase) {
145-
// Workspaces with multiple folders have the folder names as the root folder,
146-
// but workspaces with only a single folder don't. So prepend the workspace folder name
147-
// if it is not present.
148-
if (useCase === ZipUseCase.TEST_GENERATION) {
149-
return path.join(projectName, relativePath)
150-
}
151-
return relativePath.split('/').shift() === projectName ? relativePath : path.join(projectName, relativePath)
144+
protected getZipEntryPath(projectName: string, relativePath: string) {
145+
return path.join(projectName, relativePath)
152146
}
153147

154148
/**
@@ -423,7 +417,8 @@ export class ZipUtil {
423417
this.getProjectScanPayloadSizeLimitInBytes()
424418
)
425419
for (const file of sourceFiles) {
426-
const zipEntryPath = this.getZipEntryPath(file.workspaceFolder.name, file.relativeFilePath, useCase)
420+
const projectName = path.basename(file.workspaceFolder.uri.fsPath)
421+
const zipEntryPath = this.getZipEntryPath(projectName, file.relativeFilePath)
427422

428423
if (ZipConstants.knownBinaryFileExts.includes(path.extname(file.fileUri.fsPath))) {
429424
if (useCase === ZipUseCase.TEST_GENERATION) {

0 commit comments

Comments
 (0)