-
Notifications
You must be signed in to change notification settings - Fork 751
fix(amazonq): Prevent adding same file twice for /doc and /dev #6568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "type": "Bug Fix", | ||
| "description": "/dev and /doc: Multi-root workspace with duplicate files causes infinite 'Uploading code...' loop" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,8 +48,14 @@ export async function prepareRepoData( | |
|
|
||
| let totalBytes = 0 | ||
| const ignoredExtensionMap = new Map<string, number>() | ||
| const addedFilePaths = new Set() | ||
|
|
||
| for (const file of files) { | ||
| if (addedFilePaths.has(file.zipFilePath)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does collectFiles returns same file path if sourcePaths/repoRootPaths > 1 ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we have a file that shows up in a multi root workspace more than once, then collectFiles will output it multiple times, all with the same zipFilePath |
||
| continue | ||
| } | ||
| addedFilePaths.add(file.zipFilePath) | ||
|
|
||
| let fileSize | ||
| try { | ||
| fileSize = (await fs.stat(file.fileUri)).size | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're mostly just testing that this doesn't reject right? Does it make sense to wrap this with:
? otherwise the PR looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the testPrepareRepoData has asserts inside of it, which will fail if the function fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error thrown by the test would be
Error: File already exists at ZipWriter.addwhich indicates the root cause, the extra assert is not needed