Skip to content

Commit 0f1f582

Browse files
committed
Avoid URL as map key
1 parent 89e04b0 commit 0f1f582

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt

+6-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import com.coder.gateway.services.CoderRecentWorkspaceConnectionsService
1717
import com.coder.gateway.services.CoderRestClientService
1818
import com.coder.gateway.services.CoderSettingsService
1919
import com.coder.gateway.util.humanizeConnectionError
20+
import com.coder.gateway.util.toURL
2021
import com.coder.gateway.util.withPath
2122
import com.coder.gateway.util.withoutNull
2223
import com.intellij.icons.AllIcons
@@ -305,7 +306,7 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
305306
/**
306307
* Get valid connections grouped by deployment and workspace.
307308
*/
308-
private fun getConnectionsByDeployment(filter: Boolean): Map<URL, Map<String, List<WorkspaceProjectIDE>>> {
309+
private fun getConnectionsByDeployment(filter: Boolean): Map<String, Map<String, List<WorkspaceProjectIDE>>> {
309310
return recentConnectionsService.getAllRecentConnections()
310311
// Validate and parse connections.
311312
.mapNotNull {
@@ -319,7 +320,7 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
319320
}
320321
.filter { !filter || matchesFilter(it) }
321322
// Group by the deployment.
322-
.groupBy { it.deploymentURL }
323+
.groupBy { it.deploymentURL.toString() }
323324
// Group the connections in each deployment by workspace.
324325
.mapValues { (_, connections) ->
325326
connections
@@ -373,8 +374,8 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
373374
try {
374375
val client = deployment.client
375376
?: CoderRestClientService(
376-
deploymentURL,
377-
settings.token(deploymentURL)?.first,
377+
deploymentURL.toURL(),
378+
settings.token(deploymentURL.toURL())?.first,
378379
)
379380

380381
// Delete connections that have no workspace.
@@ -390,7 +391,7 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
390391
deployment.items = items
391392
deployment.error = null
392393
} catch (e: Exception) {
393-
val msg = humanizeConnectionError(deploymentURL, settings.requireTokenAuth, e)
394+
val msg = humanizeConnectionError(deploymentURL.toURL(), settings.requireTokenAuth, e)
394395
deployment.items = null
395396
deployment.error = msg
396397
logger.error(msg, e)

0 commit comments

Comments
 (0)