Skip to content

Commit

Permalink
i/statemachine: Check if the copy file source is absolute
Browse files Browse the repository at this point in the history
Signed-off-by: Sudhakar Verma <[email protected]>
  • Loading branch information
sudhackar committed Dec 10, 2024
1 parent 4842e19 commit 0830a68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/statemachine/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,10 @@ func manualMakeDirs(customizations []*imagedefinition.MakeDirs, targetDir string
// manualCopyFile copies a file into the chroot
func manualCopyFile(customizations []*imagedefinition.CopyFile, confDefPath string, targetDir string, debug bool) error {
for _, c := range customizations {
source := filepath.Join(confDefPath, c.Source)
source := c.Source
if !filepath.IsAbs(source) {
source = filepath.Join(confDefPath, source)
}

Check warning on line 759 in internal/statemachine/helper.go

View check run for this annotation

Codecov / codecov/patch

internal/statemachine/helper.go#L758-L759

Added lines #L758 - L759 were not covered by tests
dest := filepath.Join(targetDir, c.Dest)
if debug {
fmt.Printf("Copying file \"%s\" to \"%s\"\n", source, dest)
Expand Down

0 comments on commit 0830a68

Please sign in to comment.