Skip to content

Commit

Permalink
Merge pull request #1628 from israelshirk/hotfix/docker-communicator-…
Browse files Browse the repository at this point in the history
…symlink

Fixes Docker communicator mishandling of symlinks in UploadDir()
  • Loading branch information
sethvargo committed Nov 26, 2014
2 parents 96c8136 + d408024 commit 1954cc9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions builder/docker/communicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ func (c *Communicator) UploadDir(dst string, src string, exclude []string) error
return os.MkdirAll(hostpath, info.Mode())
}

if info.Mode() & os.ModeSymlink == os.ModeSymlink {
dest, err := os.Readlink(path)

if err != nil {
return err
}

return os.Symlink(dest, hostpath)
}

// It is a file, copy it over, including mode.
src, err := os.Open(path)
if err != nil {
Expand Down

0 comments on commit 1954cc9

Please sign in to comment.