From 21428f5f30d753bcac48d30c11250f28842a8e2e Mon Sep 17 00:00:00 2001 From: Joao Salles Date: Tue, 30 Apr 2024 11:19:39 +0200 Subject: [PATCH] fix(featureDev): Prevent crash on large repos or unsupported encoding during file collection --- ...-f5decdc1-1202-45f7-891c-b89643214089.json | 4 ++ .../core/src/amazonqFeatureDev/constants.ts | 3 + .../core/src/amazonqFeatureDev/util/files.ts | 60 +++++++++++++------ 3 files changed, 49 insertions(+), 18 deletions(-) create mode 100644 packages/amazonq/.changes/next-release/Bug Fix-f5decdc1-1202-45f7-891c-b89643214089.json diff --git a/packages/amazonq/.changes/next-release/Bug Fix-f5decdc1-1202-45f7-891c-b89643214089.json b/packages/amazonq/.changes/next-release/Bug Fix-f5decdc1-1202-45f7-891c-b89643214089.json new file mode 100644 index 00000000000..657281df6ee --- /dev/null +++ b/packages/amazonq/.changes/next-release/Bug Fix-f5decdc1-1202-45f7-891c-b89643214089.json @@ -0,0 +1,4 @@ +{ + "type": "Bug Fix", + "description": "Fixed a crash when trying to use Q /dev on large projects or projects containing files with unsupported encoding." +} diff --git a/packages/core/src/amazonqFeatureDev/constants.ts b/packages/core/src/amazonqFeatureDev/constants.ts index e20023373aa..bfa05eadbe3 100644 --- a/packages/core/src/amazonqFeatureDev/constants.ts +++ b/packages/core/src/amazonqFeatureDev/constants.ts @@ -14,6 +14,9 @@ export const featureDevChat = 'featureDevChat' export const featureName = 'Amazon Q feature development' +// Max allowed size for file collection +export const maxRepoSizeBytes = 200 * 1024 * 1024 + // License text that's used in codewhisperer reference log export const referenceLogText = (reference: CodeReference) => `[${new Date().toLocaleString()}] Accepted recommendation from Amazon Q. Code provided with reference under