diff --git a/pkg/download/downloader.go b/pkg/download/downloader.go index 19448f13..dbd8a98c 100644 --- a/pkg/download/downloader.go +++ b/pkg/download/downloader.go @@ -125,6 +125,10 @@ func extractTARGZ(targetDir string, at io.ReaderAt, size int64) error { if err := os.MkdirAll(path, os.FileMode(hdr.Mode)); err != nil { return errors.Wrap(err, "failed to create directory from tar") } + case tar.TypeSymlink: + if err := os.Symlink(hdr.Linkname, path); err != nil { + return errors.Wrap(err, "failed to create symlink from tar") + } case tar.TypeReg: dir := filepath.Dir(path) glog.V(4).Infof("tar: ensuring parent dirs exist for regular file, dir=%s", dir) diff --git a/pkg/download/downloader_test.go b/pkg/download/downloader_test.go index b8960dbb..c1264c74 100644 --- a/pkg/download/downloader_test.go +++ b/pkg/download/downloader_test.go @@ -89,6 +89,10 @@ func Test_extractTARGZ(t *testing.T) { in: "test-without-directory.tar.gz", files: []string{"/foo"}, }, + { + in: "test-with-symlinks.tar.gz", + files: []string{"/symlinks/", "/symlinks/message", "/symlinks/msg"}, + }, { in: "test-with-nesting-with-directory-entries.tar.gz", files: []string{ diff --git a/pkg/download/testdata/test-with-symlinks.tar.gz b/pkg/download/testdata/test-with-symlinks.tar.gz new file mode 100644 index 00000000..c846fe09 Binary files /dev/null and b/pkg/download/testdata/test-with-symlinks.tar.gz differ