Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix windows path bug #280

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/api/kpm_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func RunOciPkg(ociRef, version string, opts *opt.CompileOptions) (*kcl.KCLResult
// clean the temp dir.
defer os.RemoveAll(tmpDir)

localPath := ociOpts.AddStoragePathSuffix(tmpDir)
localPath := ociOpts.SanitizePathWithSuffix(tmpDir)

// 2. Pull the tar.
err = oci.Pull(localPath, ociOpts.Reg, ociOpts.Repo, ociOpts.Tag, kpmcli.GetSettings())
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ func (c *KpmClient) CompileOciPkg(ociSource, version string, opts *opt.CompileOp
// clean the temp dir.
defer os.RemoveAll(tmpDir)

localPath := ociOpts.AddStoragePathSuffix(tmpDir)
localPath := ociOpts.SanitizePathWithSuffix(tmpDir)

// 2. Pull the tar.
err = c.pullTarFromOci(localPath, ociOpts)
Expand Down Expand Up @@ -1015,7 +1015,7 @@ func (c *KpmClient) PullFromOci(localPath, source, tag string) error {
// clean the temp dir.
defer os.RemoveAll(tmpDir)

storepath := ociOpts.AddStoragePathSuffix(tmpDir)
storepath := ociOpts.SanitizePathWithSuffix(tmpDir)
err = c.pullTarFromOci(storepath, ociOpts)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions pkg/opt/opt.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ func ParseOciUrl(ociUrl string) (*OciOptions, *reporter.KpmEvent) {
// }
//
// You will get a path '/usr/test/docker.io/test/testRepo/v0.0.1'.
// Deprecated: This function will be deprecated, use 'SanitizePathWithSuffix' instead.
func (oci *OciOptions) AddStoragePathSuffix(pathPrefix string) string {
return filepath.Join(filepath.Join(filepath.Join(pathPrefix, oci.Reg), oci.Repo), oci.Tag)
}
Expand Down
Loading