Skip to content

Commit

Permalink
fix: docker cp of dangling symlink (#943) (#948)
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 27, 2022
1 parent 7dbf3fc commit c802064
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/container/docker_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,11 @@ func (cr *containerReference) copyDir(dstPath string, srcPath string, useGitIgno
return err
}

// symlinks don't need to be copied
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
return nil
}

// open files for taring
f, err := os.Open(file)
if err != nil {
Expand All @@ -635,10 +640,6 @@ func (cr *containerReference) copyDir(dstPath string, srcPath string, useGitIgno

// copy file data into tar writer
if _, err := io.Copy(tw, f); err != nil {
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
// symlinks don't need to be copied, ignore this error
err = nil
}
return err
}

Expand Down

0 comments on commit c802064

Please sign in to comment.