Skip to content

Commit

Permalink
Do not use filepath.Separator for splitting URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
KnVerey committed Jan 24, 2023
1 parent d315600 commit 8b21844
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/internal/git/repospec.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const (
refQuery = "?ref="
gitSuffix = ".git"
gitRootDelimiter = "_git/"
pathSeparator = string(filepath.Separator)
pathSeparator = "/" // do not use filepath.Separator, as this is a URL
)

// NewRepoSpecFromURL parses git-like urls.
Expand Down Expand Up @@ -198,8 +198,8 @@ func tryDefaultLengthSplit(n string, defaultSegmentLength int) (string, string,
}

func kustRootPathExitsRepo(kustRootPath string) bool {
cleanedPath := filepath.Clean(strings.TrimPrefix(kustRootPath, pathSeparator))
pathElements := strings.Split(cleanedPath, pathSeparator)
cleanedPath := filepath.Clean(strings.TrimPrefix(kustRootPath, string(filepath.Separator)))
pathElements := strings.Split(cleanedPath, string(filepath.Separator))
return len(pathElements) > 0 &&
pathElements[0] == filesys.ParentDir
}
Expand Down

0 comments on commit 8b21844

Please sign in to comment.