]> Sergey Matveev's repositories - path-extractor.git/blobdiff - validators.go
Convert option to string
[path-extractor.git] / validators.go
index adc811666613f33c9c5c9aae31f6a390f2d66170..fe2156d3330572b6c612a18add76cda06ffbe8b6 100644 (file)
@@ -52,7 +52,7 @@ func replaceGitPath(input string) string {
 }
 
 func isVersion(input string) bool {
-       r := regexp.MustCompile("[0-9x]\\.[0-9x]{1,2}(\\.[0-9x]{1,3})?")
+       r := regexp.MustCompile("^v?[0-9x]\\.[0-9x]{1,2}(\\.[0-9x]{1,3})?$")
        return r.Match([]byte(input))
 }
 
@@ -67,7 +67,7 @@ func endsWithInvalidString(input string) bool {
 }
 
 func containsInvalidString(input string) bool {
-       invalidStrings := []string{"()", "and/or", "origin/", "{", "}", "<", ">", "$", "*", "this."}
+       invalidStrings := []string{"//", "()", "and/or", "origin/", "{", "}", "<", ">", "$", "*", "this."}
        for _, s := range invalidStrings {
                if strings.Contains(input, s) {
                        return true