Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 5 additions & 1 deletion codersdk/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,12 @@ func DefaultSupportLinks(docsURL string) []LinkConfig {
}
}

func RemoveTrailingVersionInfo(v string) string {
return strings.Split(strings.Split(v, "-")[0], "+")[0]
}

func DefaultDocsURL() string {
version := strings.Split(buildinfo.Version(), "-")[0]
version := RemoveTrailingVersionInfo(buildinfo.Version())
if version == "v0.0.0" {
return "https://coder.com/docs"
}
Expand Down
26 changes: 26 additions & 0 deletions codersdk/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,3 +565,29 @@ func TestPremiumSuperSet(t *testing.T) {
require.NotContains(t, enterprise.Features(), "", "enterprise should not contain empty string")
require.NotContains(t, premium.Features(), "", "premium should not contain empty string")
}

func TestRemoveTrailingVersionInfo(t *testing.T) {
t.Parallel()

testCases := []struct {
Version string
ExpectedAfterStrippingInfo string
}{
{
Version: "v2.16.0+683a720",
ExpectedAfterStrippingInfo: "v2.16.0",
},
{
Version: "v2.16.0-devel+683a720)",
ExpectedAfterStrippingInfo: "v2.16.0",
},
}

for _, tc := range testCases {
// Is this still necessary?
tc := tc

stripped := codersdk.RemoveTrailingVersionInfo(tc.Version)
require.Equal(t, tc.ExpectedAfterStrippingInfo, stripped)
}
}
94 changes: 0 additions & 94 deletions site/src/theme/icons.json

This file was deleted.

Loading