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

Commit971b1a8

Browse files
sreyabcpeinhardt
andauthored
fix: fix bug with trailing version info not being properly stripped (… (#15223)
#14963)Fixes a bug where excess version info was not being stripped properlyfrom documentation links.Co-authored-by: Benjamin Peinhardt <61021968+bcpeinhardt@users.noreply.github.com>
1 parent5133315 commit971b1a8

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

‎codersdk/deployment.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,12 @@ func DefaultSupportLinks(docsURL string) []LinkConfig {
804804
}
805805
}
806806

807+
funcremoveTrailingVersionInfo(vstring)string {
808+
returnstrings.Split(strings.Split(v,"-")[0],"+")[0]
809+
}
810+
807811
funcDefaultDocsURL()string {
808-
version:=strings.Split(buildinfo.Version(),"-")[0]
812+
version:=removeTrailingVersionInfo(buildinfo.Version())
809813
ifversion=="v0.0.0" {
810814
return"https://coder.com/docs"
811815
}

‎codersdk/deployment_internal_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package codersdk
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/require"
7+
)
8+
9+
funcTestRemoveTrailingVersionInfo(t*testing.T) {
10+
t.Parallel()
11+
12+
testCases:= []struct {
13+
Versionstring
14+
ExpectedAfterStrippingInfostring
15+
}{
16+
{
17+
Version:"v2.16.0+683a720",
18+
ExpectedAfterStrippingInfo:"v2.16.0",
19+
},
20+
{
21+
Version:"v2.16.0-devel+683a720",
22+
ExpectedAfterStrippingInfo:"v2.16.0",
23+
},
24+
{
25+
Version:"v2.16.0+683a720-devel",
26+
ExpectedAfterStrippingInfo:"v2.16.0",
27+
},
28+
}
29+
30+
for_,tc:=rangetestCases {
31+
tc:=tc
32+
33+
stripped:=removeTrailingVersionInfo(tc.Version)
34+
require.Equal(t,tc.ExpectedAfterStrippingInfo,stripped)
35+
}
36+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp