config/module: fix regression of ignoring forced type if valid URL

/cc @ceh - Does this break Windows at all? This regressed with your
commit (we didn't have test coverage on it). I added a test now, though.
This commit is contained in:
Mitchell Hashimoto 2015-02-01 20:17:56 +01:00
parent 86a6008f1b
commit 2d9dd25493
2 changed files with 7 additions and 1 deletions

View File

@ -41,7 +41,7 @@ func Detect(src string, pwd string) (string, error) {
u, err := urlParse(getSrc) u, err := urlParse(getSrc)
if err == nil && u.Scheme != "" { if err == nil && u.Scheme != "" {
// Valid URL // Valid URL
return u.String(), nil return src, nil
} }
for _, d := range Detectors { for _, d := range Detectors {

View File

@ -31,6 +31,12 @@ func TestDetect(t *testing.T) {
"git::https://github.com/hashicorp/foo.git//bar", "git::https://github.com/hashicorp/foo.git//bar",
false, false,
}, },
{
"git::https://github.com/hashicorp/consul.git",
"",
"git::https://github.com/hashicorp/consul.git",
false,
},
} }
for i, tc := range cases { for i, tc := range cases {