2026-11-30 01:24:29 +00:00
|
|
|
package fileops
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"testing"
|
|
|
|
|
)
|
|
|
|
|
|
2026-12-02 21:36:30 +00:00
|
|
|
func TestEnsureWorkspaceDirectoryUnderRootRejectsSymlink(t *testing.T) {
|
2026-11-30 01:24:29 +00:00
|
|
|
root := t.TempDir()
|
2026-12-02 21:36:30 +00:00
|
|
|
if err := os.Symlink(t.TempDir(), filepath.Join(root, "link")); err != nil {
|
2026-11-30 01:24:29 +00:00
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
2026-12-02 21:36:30 +00:00
|
|
|
if err := EnsureWorkspaceDirectoryUnderRoot(root, "link/nested"); err == nil {
|
|
|
|
|
t.Fatal("accepted symlink directory")
|
2026-11-30 13:54:57 +00:00
|
|
|
}
|
|
|
|
|
}
|