Skip to content

Commit 2cfbbb7

Browse files
authored
fix(amazonq): do not decode uri if window/showDocument is external (#5776)
Browser open expects an encoded uri
1 parent 32aca78 commit 2cfbbb7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,14 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
149149
return CompletableFuture.completedFuture(ShowDocumentResult(false))
150150
}
151151

152-
// The filepath sent by the server contains unicode characters which need to be
153-
// decoded for JB file handling APIs to be handle to handle file operations
154-
val fileToOpen = URLDecoder.decode(params.uri, StandardCharsets.UTF_8.name())
155152
if (params.external == true) {
156-
BrowserUtil.open(fileToOpen)
153+
BrowserUtil.open(params.uri)
157154
return CompletableFuture.completedFuture(ShowDocumentResult(true))
158155
}
159156

157+
// The filepath sent by the server contains unicode characters which need to be
158+
// decoded for JB file handling APIs to be handle to handle file operations
159+
val fileToOpen = URLDecoder.decode(params.uri, StandardCharsets.UTF_8.name())
160160
ApplicationManager.getApplication().invokeLater {
161161
try {
162162
val virtualFile = VirtualFileManager.getInstance().findFileByUrl(fileToOpen)

0 commit comments

Comments
 (0)