Fix: addon dependency package retrieving is not compatible to v-prefixed version (#6316)

This commit is contained in:
qiaozp
2023-09-02 21:00:41 +08:00
committed by GitHub
parent 08548968f0
commit 6cbc12f9bb
4 changed files with 43 additions and 9 deletions
+5
View File
@@ -80,3 +80,8 @@ func Sanitize(s string) string {
s = strings.ReplaceAll(s, "\r", "")
return s
}
// IgnoreVPrefix removes the leading "v" from a string
func IgnoreVPrefix(s string) string {
return strings.TrimPrefix(s, "v")
}
+5
View File
@@ -26,3 +26,8 @@ func TestSanitize(t *testing.T) {
s := "abc\ndef\rgh"
require.Equal(t, "abcdefgh", Sanitize(s))
}
func TestIgnoreVPrefix(t *testing.T) {
require.Equal(t, "1.2.0", IgnoreVPrefix("v1.2.0"))
require.Equal(t, "1.2.0", IgnoreVPrefix("1.2.0"))
}