Skip to content

Commit 334d349

Browse files
authored
fix(amazonq): fix for path parsing for windows for editable diff view (aws#8047)
## Problem aws#8045 aws#8040 ## Solution fix for path parsing for windows for editable diff view --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent c67a884 commit 334d349

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/amazonq/src/lsp/chat/messages.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,18 @@ export function registerMessageListeners(
651651
)
652652

653653
languageClient.onNotification(openFileDiffNotificationType.method, async (params: OpenFileDiffParams) => {
654-
const currentFileUri = vscode.Uri.parse(params.originalFileUri)
654+
// Handle both file:// URIs and raw file paths, ensuring proper Windows path handling
655+
let currentFileUri: vscode.Uri
656+
657+
// Check if it's already a proper file:// URI
658+
if (params.originalFileUri.startsWith('file://')) {
659+
currentFileUri = vscode.Uri.parse(params.originalFileUri)
660+
} else {
661+
// Decode URL-encoded characters and treat as file path
662+
const decodedPath = decodeURIComponent(params.originalFileUri)
663+
currentFileUri = vscode.Uri.file(decodedPath)
664+
}
665+
655666
const originalContent = params.originalFileContent ?? ''
656667
const fileName = path.basename(currentFileUri.fsPath)
657668

0 commit comments

Comments
 (0)