Skip to content

Commit 216dd73

Browse files
committed
fix(amazonq): Skip including deleted files for FeatureDev context.
1 parent 3d90772 commit 216dd73

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-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": "Amazon Q /dev: Fix issue when files are deleted while preparing context"
4+
}

packages/core/src/amazonqFeatureDev/util/files.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,17 @@ export async function prepareRepoData(
5858
totalBytes += fileSize
5959

6060
const zipFolderPath = path.dirname(file.zipFilePath)
61-
zip.addLocalFile(file.fileUri.fsPath, zipFolderPath)
61+
62+
try {
63+
zip.addLocalFile(file.fileUri.fsPath, zipFolderPath)
64+
} catch (error) {
65+
if (error instanceof Error && error.message.includes('File not found')) {
66+
// No-op: Skip if file does not exist
67+
// Reference: https://github.com/cthackers/adm-zip/blob/1cd32f7e0ad3c540142a76609bb538a5cda2292f/adm-zip.js#L296-L321
68+
continue
69+
}
70+
throw error
71+
}
6272
}
6373

6474
const iterator = ignoredExtensionMap.entries()

0 commit comments

Comments
 (0)