fix chart name verification does not meet the specification

Signed-off-by: wawa0210 <xiaozhang0210@hotmail.com>
pull/9181/head
wawa0210 4 years ago
parent 960b3b53c6
commit 57825d8ceb
No known key found for this signature in database
GPG Key ID: 900C83A2C098B3B1

@ -36,7 +36,7 @@ import (
// This regular expression is probably stricter than it needs to be. We can relax it
// somewhat. Newline characters, as well as $, quotes, +, parens, and % are known to be
// problematic.
var chartName = regexp.MustCompile("^[a-zA-Z0-9._-]+$")
var chartName = regexp.MustCompile("^[a-z0-9\\-]+$")
const (
// ChartfileName is the default Chart file name.

@ -160,8 +160,12 @@ func TestCreate_Overwrite(t *testing.T) {
func TestValidateChartName(t *testing.T) {
for name, shouldPass := range map[string]bool{
"": false,
"abcdefghijklmnopqrstuvwxyz-_.": true,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ-_.": true,
"abcdefghijklmnopqrstuvwxyz-_.": false,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ-_.": false,
"abcdefghijklmnopqrstuvwxyz": true,
"abcdefghijklmnopqrstuvwxyz_": false,
"abcdefghijklmnopqrstuvwxyz-": true,
"abcdefghijklmnopqrstuvwxyz.": false,
"$hello": false,
"Hellô": false,
"he%%o": false,

Loading…
Cancel
Save