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:
parent
86a6008f1b
commit
2d9dd25493
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue