Browse Source

expanding valid use cases for ssh:// protocol in IsGitURL

Signed-off-by: Gaddis, Matt <gaddis@pnnl.gov>
Gaddis, Matt 1 year ago
parent
commit
0135ece96f

+ 1 - 1
builder/remotecontext/urlutil/urlutil.go

@@ -78,7 +78,7 @@ func IsGitURL(str string) bool {
 	if IsURL(str) && urlPathWithFragmentSuffix.MatchString(str) {
 	if IsURL(str) && urlPathWithFragmentSuffix.MatchString(str) {
 		return true
 		return true
 	}
 	}
-	for _, prefix := range []string{"git://", "github.com/", "git@", "ssh://git@"} {
+	for _, prefix := range []string{"git://", "github.com/", "git@", "ssh://"} {
 		if strings.HasPrefix(str, prefix) {
 		if strings.HasPrefix(str, prefix) {
 			return true
 			return true
 		}
 		}

+ 2 - 0
builder/remotecontext/urlutil/urlutil_test.go

@@ -12,6 +12,8 @@ var (
 		"http://github.com/docker/docker.git#branch",
 		"http://github.com/docker/docker.git#branch",
 		"http://github.com/docker/docker.git#:dir",
 		"http://github.com/docker/docker.git#:dir",
 		"ssh://git@github.com/docker/docker.git",
 		"ssh://git@github.com/docker/docker.git",
+		"ssh://a_user@github.com/docker/docker.git",
+		"ssh://github.com/docker/docker.git",
 	}
 	}
 	incompleteGitUrls = []string{
 	incompleteGitUrls = []string{
 		"github.com/docker/docker",
 		"github.com/docker/docker",