This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/master by this push:
     new b8172eb  fix: Integration naming issues with numbers in them
b8172eb is described below

commit b8172eb0d06fe253f13c2e3285539293c1839579
Author: James Netherton <jamesnether...@gmail.com>
AuthorDate: Thu Jun 27 09:30:19 2019 +0100

    fix: Integration naming issues with numbers in them
    
    fixes #777
---
 pkg/util/kubernetes/sanitize.go      | 2 +-
 pkg/util/kubernetes/sanitize_test.go | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/pkg/util/kubernetes/sanitize.go b/pkg/util/kubernetes/sanitize.go
index fd6bef7..1ed8026 100644
--- a/pkg/util/kubernetes/sanitize.go
+++ b/pkg/util/kubernetes/sanitize.go
@@ -48,5 +48,5 @@ func SanitizeLabel(name string) string {
 }
 
 func isDisallowedStartEndChar(rune rune) bool {
-       return !unicode.IsLetter(rune)
+       return !unicode.IsLetter(rune) && !unicode.IsNumber(rune)
 }
diff --git a/pkg/util/kubernetes/sanitize_test.go 
b/pkg/util/kubernetes/sanitize_test.go
index 839bf05..31b422e 100644
--- a/pkg/util/kubernetes/sanitize_test.go
+++ b/pkg/util/kubernetes/sanitize_test.go
@@ -33,6 +33,9 @@ func TestSanitizeName(t *testing.T) {
                {"input": "http://foo.bar.com/cheese/wine/beer/abc.java";, 
"expect": "abc"},
                {"input": "http://foo.bar.com/cheese";, "expect": "cheese"},
                {"input": "http://foo.bar.com";, "expect": "foo"},
+               {"input": "-foo-bar-", "expect": "foo-bar"},
+               {"input": "1foo-bar2", "expect": "1foo-bar2"},
+               {"input": "foo-bar-1", "expect": "foo-bar-1"},
        }
 
        for _, c := range cases {

Reply via email to