Skip to content
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/tar-diff/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ func analyzeForDelta(old *tarInfo, new *tarInfo, oldFile io.Reader) (*deltaAnaly
targetInfoByIndex[hl.index] = &targetInfos[len(targetInfos)-1]
}

tmpfile, err := os.CreateTemp("/var/tmp", "tar-diff-")
tmpfile, err := os.CreateTemp(os.TempDir(), "tar-diff-")
if err != nil {
return nil, err
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/tar-patch/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"os"
"path"
"path/filepath"

"github.com/containers/tar-diff/pkg/common"
"github.com/klauspost/compress/zstd"
Expand All @@ -29,7 +30,7 @@ type FilesystemDataSource struct {
func cleanPath(pathName string) string {
// We make the path always absolute, that way path.Clean() ensure it never goes outside the top ("root") dir
// even if its a relative path
clean := path.Clean("/" + pathName)
clean := path.Clean(path.Join("/", pathName))

// We clean the initial slash, making all result relative (or "" which is error)
return clean[1:]
Expand Down Expand Up @@ -69,7 +70,7 @@ func (f *FilesystemDataSource) SetCurrentFile(file string) error {
return nil
}
}
currentFile, err := os.Open(f.basePath + "/" + file)
currentFile, err := os.Open(filepath.Join(f.basePath, file))
if err != nil {
return err
}
Expand Down