mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
config/module: fix test failures on Windows
When parsing URLs on Windows, assume it is a drive letter path if the second element is a ':' character. Format the drive letter path as a "file:///"-path prior to parsing the URL. Fixes test failures of the following form in command on Windows: === RUN TestApply_plan --- FAIL: TestApply_plan (0.00s) apply_test.go:379: bad: 1 module download not supported for scheme 'c'
This commit is contained in:
parent
b40c2fe997
commit
65177edd1e
@ -9,8 +9,13 @@ import (
|
||||
|
||||
func urlParse(rawURL string) (*url.URL, error) {
|
||||
if runtime.GOOS == "windows" {
|
||||
// Make sure we're using "/" on Windows. URLs are "/"-based.
|
||||
rawURL = filepath.ToSlash(rawURL)
|
||||
if len(rawURL) > 1 && rawURL[1] == ':' {
|
||||
// Assume we're dealing with a file path.
|
||||
rawURL = fmtFileURL(rawURL)
|
||||
} else {
|
||||
// Make sure we're using "/" on Windows. URLs are "/"-based.
|
||||
rawURL = filepath.ToSlash(rawURL)
|
||||
}
|
||||
}
|
||||
u, err := url.Parse(rawURL)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user