Skip to content

Commit

Permalink
fix: Use os.PathSeparator instead of hard-coded string to resolve loc…
Browse files Browse the repository at this point in the history
…al file paths (#10945) (#10946)

fix: Use os.PathSeparator instead of hard-coded string to resolve local file paths (#10945) (#10946)
  • Loading branch information
chris-codeflow authored and alexmt committed Oct 14, 2022
1 parent 39f9565 commit cd3ce58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions util/io/path/resolved.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func resolveSymbolicLinkRecursive(path string, maxDepth int) (string, error) {

// If we resolved to a relative symlink, make sure we use the absolute
// path for further resolving
if !strings.HasPrefix(resolved, "/") {
if !strings.HasPrefix(resolved, string(os.PathSeparator)) {
basePath := filepath.Dir(path)
resolved = filepath.Join(basePath, resolved)
}
Expand Down Expand Up @@ -146,8 +146,8 @@ func ResolveFilePath(appPath, repoRoot, valueFile string, allowedURLSchemes []st
// Ensure our root path has a trailing slash, otherwise the following check
// would return true if root is /foo and path would be /foo2
requiredRootPath := absRepoPath
if !strings.HasSuffix(requiredRootPath, "/") {
requiredRootPath += "/"
if !strings.HasSuffix(requiredRootPath, string(os.PathSeparator)) {
requiredRootPath += string(os.PathSeparator)
}

// Make sure that the resolved path to values file is within the repository's root path
Expand Down

0 comments on commit cd3ce58

Please sign in to comment.