From e23d3baa92383dfb394f7808ca4544abf7255f0e Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Fri, 26 Apr 2024 14:21:35 -0400 Subject: [PATCH] use windows absolute path in test Signed-off-by: Alex Goodman --- tar_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tar_test.go b/tar_test.go index c365a6d..683308e 100644 --- a/tar_test.go +++ b/tar_test.go @@ -7,6 +7,7 @@ import ( "os" "path" "path/filepath" + "runtime" "testing" "github.com/mholt/archiver/v3" @@ -75,7 +76,13 @@ func TestDefaultTar_Unarchive_SymlinkPathTraversal(t *testing.T) { func TestDefaultTar_Unarchive_SymlinkPathTraversal_AbsLinkDestination(t *testing.T) { tmp := t.TempDir() source := filepath.Join(tmp, "source.tar") - createSymlinkPathTraversalSample(t, source, "/tmp/thing") + + linkPath := "/tmp/thing" + if runtime.GOOS == "windows" { + linkPath = "C:\\tmp\\thing" + } + + createSymlinkPathTraversalSample(t, source, linkPath) destination := filepath.Join(tmp, "destination") err := archiver.DefaultTar.Unarchive(source, destination)