Skip to content

Commit

Permalink
Merge pull request #470 from ndegory/fix469
Browse files Browse the repository at this point in the history
randomize temporary file names
  • Loading branch information
Sami Alajrami authored May 15, 2020
2 parents 2fa68be + 0115691 commit 1f7eca3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/app/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,12 @@ func resolvePaths(relativeToFile string, s *state) {
// and downloads/fetches the file locally into helmsman temp directory and returns
// its absolute path
func resolveOnePath(file string, dir string, downloadDest string) (string, error) {
destFileName := filepath.Join(downloadDest, path.Base(file))
return filepath.Abs(downloadFile(file, dir, destFileName))
if destFile, err := ioutil.TempFile(downloadDest, fmt.Sprintf("*%s", path.Base(file))); err != nil {
return "", err
} else {
_ = destFile.Close()
return filepath.Abs(downloadFile(file, dir, destFile.Name()))
}
}

// createTempDir creates a temp directory in a specific location with a pattern
Expand Down

0 comments on commit 1f7eca3

Please sign in to comment.