Skip to content

Commit

Permalink
Use forward slash when joining path, even on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cblims committed Dec 19, 2024
1 parent 214aa2a commit f0ea905
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/resource/origin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package resource

import (
"path/filepath"
"path"
"strings"

"sigs.k8s.io/kustomize/api/internal/git"
Expand Down Expand Up @@ -48,17 +48,17 @@ func (origin *Origin) Copy() Origin {
}

// Append returns a copy of origin with a path appended to it
func (origin *Origin) Append(path string) *Origin {
func (origin *Origin) Append(inputPath string) *Origin {
originCopy := origin.Copy()
repoSpec, err := git.NewRepoSpecFromURL(path)
repoSpec, err := git.NewRepoSpecFromURL(inputPath)
if err == nil {
originCopy.Repo = repoSpec.CloneSpec()
absPath := repoSpec.AbsPath()
path = absPath[strings.Index(absPath[1:], "/")+1:][1:]
inputPath = absPath[strings.Index(absPath[1:], "/")+1:][1:]
originCopy.Path = ""
originCopy.Ref = repoSpec.Ref
}
originCopy.Path = filepath.Join(originCopy.Path, path)
originCopy.Path = path.Join(originCopy.Path, inputPath)
return &originCopy
}

Expand Down

0 comments on commit f0ea905

Please sign in to comment.