Skip to content

Commit a4a02d4

Browse files
Merge main into feature/q-mega
2 parents 9e7fa03 + cc476dd commit a4a02d4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Amazon Q /dev: Fix error when accepting changes if leading slash is present."
4+
}

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/session/CodeGenerationState.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ private suspend fun CodeGenerationState.generateCode(
258258
fun registerNewFiles(newFileContents: Map<String, String>): List<NewFileZipInfo> =
259259
newFileContents.map {
260260
NewFileZipInfo(
261-
zipFilePath = it.key,
261+
// Note: When managing file state, we normalize file paths returned from the agent in order to ensure they are handled as relative paths.
262+
zipFilePath = it.key.removePrefix("/"),
262263
fileContent = it.value,
263264
rejected = false,
264265
changeApplied = false
@@ -268,7 +269,8 @@ fun registerNewFiles(newFileContents: Map<String, String>): List<NewFileZipInfo>
268269
fun registerDeletedFiles(deletedFiles: List<String>): List<DeletedFileInfo> =
269270
deletedFiles.map {
270271
DeletedFileInfo(
271-
zipFilePath = it,
272+
// Note: When managing file state, we normalize file paths returned from the agent in order to ensure they are handled as relative paths.
273+
zipFilePath = it.removePrefix("/"),
272274
rejected = false,
273275
changeApplied = false
274276
)

0 commit comments

Comments
 (0)