Skip to content

fix: handle missing workspace app display_name #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Coder-Desktop/Coder-Desktop/Views/VPN/WorkspaceAppIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ struct WorkspaceApp {
sessionToken: String
) throws(WorkspaceAppError) {
slug = original.slug
displayName = original.display_name
// Same behaviour as the web UI
displayName = original.display_name ?? original.slug

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

func vscodeInsidersDisplayApp(hostname: String, baseIconURL: URL, path: String? = nil) -> WorkspaceApp {
let icon = baseIconURL.appendingPathComponent("/icon/code.svg")
let icon = baseIconURL.appendingPathComponent("/icon/code-insiders.svg")
return WorkspaceApp(
slug: "-vscode-insiders",
displayName: "VS Code Insiders Desktop",
Expand Down
2 changes: 1 addition & 1 deletion Coder-Desktop/Coder-DesktopTests/WorkspaceAppTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ struct WorkspaceAppTests {
#expect(apps.count == 1)
#expect(apps[0].slug == "-vscode-insiders")
#expect(apps[0].displayName == "VS Code Insiders Desktop")
#expect(apps[0].icon?.absoluteString == "https://coder.example.com/icon/code.svg")
#expect(apps[0].icon?.absoluteString == "https://coder.example.com/icon/code-insiders.svg")
#expect(
apps[0].url.absoluteString == """
vscode-insiders://vscode-remote/ssh-remote+test-workspace.coder.test//home/user
Expand Down
5 changes: 2 additions & 3 deletions Coder-Desktop/CoderSDK/Workspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ public struct WorkspaceAgent: Codable, Identifiable, Sendable {

public struct WorkspaceApp: Codable, Identifiable, Sendable {
public let id: UUID
// Not `omitempty`, but `coderd` sends empty string if `command` is set
public var url: URL?
public var url: URL? // `omitempty`
public let external: Bool
public let slug: String
public let display_name: String
public let display_name: String? // `omitempty`
public let command: String? // `omitempty`
public let icon: URL? // `omitempty`
public let subdomain: Bool
Expand Down
Loading