Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb54b74a

Browse files
committed
impl: prefer agent name over agent id in URI handler
Agent name is easier to resolve in jetbrains gateway module
1 parent546d317 commitb54b74a

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

‎src/main/kotlin/com/coder/gateway/util/LinkHandler.kt‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -327,17 +327,16 @@ internal fun getMatchingAgent(
327327
}
328328

329329
// If the agent is missing and the workspace has only one, use that.
330-
// Prefer the ID over the name if both are set.
331-
val agent=
332-
if (!parameters.agentID().isNullOrBlank()) {
333-
agents.firstOrNull { it.id.toString()== parameters.agentID() }
334-
}elseif (!parameters.agentName().isNullOrBlank()) {
335-
agents.firstOrNull { it.name== parameters.agentName() }
336-
}elseif (agents.size==1) {
337-
agents.first()
338-
}else {
339-
null
340-
}
330+
// Prefer the name over the id if both are set.
331+
val agent=if (!parameters.agentName().isNullOrBlank()) {
332+
agents.firstOrNull { it.name== parameters.agentName() }
333+
}elseif (!parameters.agentID().isNullOrBlank()) {
334+
agents.firstOrNull { it.id.toString()== parameters.agentID() }
335+
}elseif (agents.size==1) {
336+
agents.first()
337+
}else {
338+
null
339+
}
341340

342341
if (agent==null) {
343342
if (!parameters.agentID().isNullOrBlank()) {

‎src/main/kotlin/com/coder/gateway/util/LinkMap.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ fun Map<String, String>.owner() = this[OWNER]
2929

3030
funMap<String,String?>.agentName()=this[AGENT_NAME]
3131

32+
@Deprecated("Use the agent name instead")
3233
funMap<String,String?>.agentID()=this[AGENT_ID]
3334

3435
funMap<String,String>.folder()=this[FOLDER]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp