Skip to content

Commit

Permalink
use windows absolute path in test
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
  • Loading branch information
wagoodman committed Apr 26, 2024
1 parent bc17d02 commit e23d3ba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tar_test.go
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path"
"path/filepath"
"runtime"
"testing"

"github.com/mholt/archiver/v3"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e23d3ba

Please sign in to comment.