Skip to content

Commit 49fd303

Browse files
fix: handle missing workspace app display_name (#154)
also uses `code-insiders.svg` for the VS Code insiders icon. Context: coder/coder#17700
1 parent 565665f commit 49fd303

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Coder-Desktop/Coder-Desktop/Views/VPN/WorkspaceAppIcon.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ struct WorkspaceApp {
7575
sessionToken: String
7676
) throws(WorkspaceAppError) {
7777
slug = original.slug
78-
displayName = original.display_name
78+
// Same behaviour as the web UI
79+
displayName = original.display_name ?? original.slug
7980

8081
guard original.external else {
8182
throw .isWebApp
@@ -196,7 +197,7 @@ func vscodeDisplayApp(hostname: String, baseIconURL: URL, path: String? = nil) -
196197
}
197198

198199
func vscodeInsidersDisplayApp(hostname: String, baseIconURL: URL, path: String? = nil) -> WorkspaceApp {
199-
let icon = baseIconURL.appendingPathComponent("/icon/code.svg")
200+
let icon = baseIconURL.appendingPathComponent("/icon/code-insiders.svg")
200201
return WorkspaceApp(
201202
slug: "-vscode-insiders",
202203
displayName: "VS Code Insiders Desktop",

Coder-Desktop/Coder-DesktopTests/WorkspaceAppTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct WorkspaceAppTests {
137137
#expect(apps.count == 1)
138138
#expect(apps[0].slug == "-vscode-insiders")
139139
#expect(apps[0].displayName == "VS Code Insiders Desktop")
140-
#expect(apps[0].icon?.absoluteString == "https://coder.example.com/icon/code.svg")
140+
#expect(apps[0].icon?.absoluteString == "https://coder.example.com/icon/code-insiders.svg")
141141
#expect(
142142
apps[0].url.absoluteString == """
143143
vscode-insiders://vscode-remote/ssh-remote+test-workspace.coder.test//home/user

Coder-Desktop/CoderSDK/Workspace.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ public struct WorkspaceAgent: Codable, Identifiable, Sendable {
5656

5757
public struct WorkspaceApp: Codable, Identifiable, Sendable {
5858
public let id: UUID
59-
// Not `omitempty`, but `coderd` sends empty string if `command` is set
60-
public var url: URL?
59+
public var url: URL? // `omitempty`
6160
public let external: Bool
6261
public let slug: String
63-
public let display_name: String
62+
public let display_name: String? // `omitempty`
6463
public let command: String? // `omitempty`
6564
public let icon: URL? // `omitempty`
6665
public let subdomain: Bool

0 commit comments

Comments
 (0)