Merge origin/main into fix/tunnel-traversal (conflict-only)
Conflict in ingestion/internal/brainfs/brainfs_test.go only: both sides appended a test after TestReadRegularNeverReturnsAnInBrainFileSwappedInBehindASymlink (this branch: TestWriteRegularRefusesFinalSymlinksFIFOsEscapesAndMissingFilesAndRewritesRegularFiles; main: TestReadDirDirsListsOnlyRealSubdirsAndRefusesSymlinkedComponents). Kept both, unchanged. No production code touched by the resolution. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -308,3 +308,21 @@ func TestWriteRegularRefusesFinalSymlinksFIFOsEscapesAndMissingFilesAndRewritesR
|
||||
got, _ = os.ReadFile(filepath.Join(dir, "n.md"))
|
||||
assert.Equal(t, "new", string(got), "truncated and rewritten")
|
||||
}
|
||||
|
||||
func TestReadDirDirsListsOnlyRealSubdirsAndRefusesSymlinkedComponents(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
require.NoError(t, os.MkdirAll(filepath.Join(dir, "a", "real"), 0o755))
|
||||
require.NoError(t, os.MkdirAll(filepath.Join(dir, "other"), 0o755))
|
||||
require.NoError(t, os.Symlink(filepath.Join("..", "other"), filepath.Join(dir, "a", "linked")))
|
||||
require.NoError(t, os.WriteFile(filepath.Join(dir, "a", "f.md"), []byte("f"), 0o644))
|
||||
require.NoError(t, os.Symlink("a", filepath.Join(dir, "alias")))
|
||||
b, err := Open(dir)
|
||||
require.NoError(t, err)
|
||||
defer func() { _ = b.Close() }()
|
||||
|
||||
names, err := b.ReadDirDirs("a")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, []string{"real"}, names)
|
||||
_, err = b.ReadDirDirs("alias")
|
||||
assert.ErrorIs(t, err, ErrNotRegular)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user