mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-18 03:56:36 +00:00
Fix: addon dependency package retrieving is not compatible to v-prefixed version (#6316)
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user