From 4210557fc2276988f8b76c7e8f698d16d2872587 Mon Sep 17 00:00:00 2001 From: Alberto Donato Date: Thu, 11 Jan 2024 11:00:14 +0100 Subject: [PATCH] TEST --- .github/workflows/ci.yml | 2 +- server/filesystem.go | 3 ++- testhelpers/tempdir.go | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e62ec92..9c1c180 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,4 +62,4 @@ jobs: - name: Test run: | - go test ./... + go test -v ./... diff --git a/server/filesystem.go b/server/filesystem.go index e8720f2..0458453 100644 --- a/server/filesystem.go +++ b/server/filesystem.go @@ -72,7 +72,7 @@ func (fs FileSystem) newFile(name string) (*File, error) { } if !fs.AllowOutsideSymlinks { if target, err := filepath.EvalSymlinks(absPath); target != "" { - if err != nil { + if err != nil { return nil, err } path, err := filepath.Abs(target) @@ -83,6 +83,7 @@ func (fs FileSystem) newFile(name string) (*File, error) { if err != nil { return nil, err } + fmt.Println("-->", target, path, root, strings.HasPrefix(path, root)) if !strings.HasPrefix(path, root) { return nil, os.ErrPermission } diff --git a/testhelpers/tempdir.go b/testhelpers/tempdir.go index c9c66f3..b63bc6c 100644 --- a/testhelpers/tempdir.go +++ b/testhelpers/tempdir.go @@ -1,6 +1,7 @@ package testhelpers import ( + "fmt" "os" "path/filepath" @@ -56,6 +57,7 @@ func (s *TempDirTestSuite) Mkdir(name string) string { // the new name. Both paths are relative to the tempdir path. func (s *TempDirTestSuite) Symlink(oldname, newname string) string { newPath := s.absPath(newname) + fmt.Println(">>", oldname, newname, newPath) err := os.Symlink(oldname, newPath) s.Nil(err) return newPath