fix: docker cp of dangling symlink (#943) (#948)

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Josh Soref 2022-01-27 11:53:26 -05:00 committed by GitHub
parent 7dbf3fcb96
commit c802064975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -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 {
@ -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
}