Skip to content

Commit

Permalink
fix(amazonq): Skip including deleted files for FeatureDev context.
Browse files Browse the repository at this point in the history
  • Loading branch information
neilk-aws committed Jan 6, 2025
1 parent 3d90772 commit 216dd73
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Amazon Q /dev: Fix issue when files are deleted while preparing context"
}
12 changes: 11 additions & 1 deletion packages/core/src/amazonqFeatureDev/util/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,17 @@ export async function prepareRepoData(
totalBytes += fileSize

const zipFolderPath = path.dirname(file.zipFilePath)
zip.addLocalFile(file.fileUri.fsPath, zipFolderPath)

try {
zip.addLocalFile(file.fileUri.fsPath, zipFolderPath)
} catch (error) {
if (error instanceof Error && error.message.includes('File not found')) {
// No-op: Skip if file does not exist
// Reference: https://github.com/cthackers/adm-zip/blob/1cd32f7e0ad3c540142a76609bb538a5cda2292f/adm-zip.js#L296-L321
continue
}
throw error
}
}

const iterator = ignoredExtensionMap.entries()
Expand Down

0 comments on commit 216dd73

Please sign in to comment.