mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-09-15 12:18:57 +00:00
Do not use filepath.Separator for splitting URLs
This commit is contained in:
@@ -79,7 +79,7 @@ const (
|
|||||||
refQuery = "?ref="
|
refQuery = "?ref="
|
||||||
gitSuffix = ".git"
|
gitSuffix = ".git"
|
||||||
gitRootDelimiter = "_git/"
|
gitRootDelimiter = "_git/"
|
||||||
pathSeparator = string(filepath.Separator)
|
pathSeparator = "/" // do not use filepath.Separator, as this is a URL
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewRepoSpecFromURL parses git-like urls.
|
// NewRepoSpecFromURL parses git-like urls.
|
||||||
@@ -198,8 +198,8 @@ func tryDefaultLengthSplit(n string, defaultSegmentLength int) (string, string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func kustRootPathExitsRepo(kustRootPath string) bool {
|
func kustRootPathExitsRepo(kustRootPath string) bool {
|
||||||
cleanedPath := filepath.Clean(strings.TrimPrefix(kustRootPath, pathSeparator))
|
cleanedPath := filepath.Clean(strings.TrimPrefix(kustRootPath, string(filepath.Separator)))
|
||||||
pathElements := strings.Split(cleanedPath, pathSeparator)
|
pathElements := strings.Split(cleanedPath, string(filepath.Separator))
|
||||||
return len(pathElements) > 0 &&
|
return len(pathElements) > 0 &&
|
||||||
pathElements[0] == filesys.ParentDir
|
pathElements[0] == filesys.ParentDir
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user