mirror of
https://github.com/go-gitea/gitea
synced 2025-07-07 19:17:21 +00:00
Use filepath.Join instead of path.Join for file system file operations (#33978)
This commit is contained in:
@ -10,7 +10,6 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"testing"
|
||||
@ -35,12 +34,12 @@ func withKeyFile(t *testing.T, keyname string, callback func(string)) {
|
||||
err = ssh.GenKeyPair(keyFile)
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = os.WriteFile(path.Join(tmpDir, "ssh"), []byte("#!/bin/bash\n"+
|
||||
err = os.WriteFile(filepath.Join(tmpDir, "ssh"), []byte("#!/bin/bash\n"+
|
||||
"ssh -o \"UserKnownHostsFile=/dev/null\" -o \"StrictHostKeyChecking=no\" -o \"IdentitiesOnly=yes\" -i \""+keyFile+"\" \"$@\""), 0o700)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Setup ssh wrapper
|
||||
t.Setenv("GIT_SSH", path.Join(tmpDir, "ssh"))
|
||||
t.Setenv("GIT_SSH", filepath.Join(tmpDir, "ssh"))
|
||||
t.Setenv("GIT_SSH_COMMAND",
|
||||
"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i \""+keyFile+"\"")
|
||||
t.Setenv("GIT_SSH_VARIANT", "ssh")
|
||||
|
Reference in New Issue
Block a user