]> Sergey Matveev's repositories - btrtrc.git/blobdiff - storage/safe-path_test.go
Drop support for go 1.20
[btrtrc.git] / storage / safe-path_test.go
index e12d3333cdb5d626d89934d50aa01b88eb09a888..452ab283ff6c73701b2fac0a3cc54c4543c54e95 100644 (file)
@@ -6,8 +6,9 @@ import (
        "path/filepath"
        "testing"
 
-       "github.com/anacrolix/torrent/metainfo"
        qt "github.com/frankban/quicktest"
+
+       "github.com/anacrolix/torrent/metainfo"
 )
 
 func init() {
@@ -24,8 +25,10 @@ var safeFilePathTests = []struct {
        {input: []string{"a", filepath.FromSlash(`b/..`)}, expectErr: false},
        {input: []string{"a", filepath.FromSlash(`b/../../..`)}, expectErr: true},
        {input: []string{"a", filepath.FromSlash(`b/../.././..`)}, expectErr: true},
-       {input: []string{
-               filepath.FromSlash(`NewSuperHeroMovie-2019-English-720p.avi /../../../../../Roaming/Microsoft/Windows/Start Menu/Programs/Startup/test3.exe`)},
+       {
+               input: []string{
+                       filepath.FromSlash(`NewSuperHeroMovie-2019-English-720p.avi /../../../../../Roaming/Microsoft/Windows/Start Menu/Programs/Startup/test3.exe`),
+               },
                expectErr: true,
        },
 }
@@ -54,7 +57,7 @@ func TestFileOptsSafeFilePathHandling(t *testing.T) {
                                },
                        }
                        client := NewFileOpts(NewFileClientOpts{
-                               ClientBaseDir: "somedir",
+                               ClientBaseDir: t.TempDir(),
                        })
                        defer func() { c.Check(client.Close(), qt.IsNil) }()
                        torImpl, err := client.OpenTorrent(&info, metainfo.Hash{})