fix(protocol): loosen restriction on size of directory entries (#10743)

The synthetic directory size must be permitted.

Ref #10737.

---------

Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Jakob Borg
2026-06-13 06:31:26 +00:00
committed by GitHub
parent ee275fee65
commit f1d631d66e
2 changed files with 61 additions and 2 deletions
+55
View File
@@ -451,6 +451,61 @@ func TestCheckConsistency(t *testing.T) {
},
ok: false,
},
{
// directory with zero size
fi: FileInfo{
Name: "foo",
Type: FileInfoTypeDirectory,
},
ok: true,
},
{
// directory with synthetic size
fi: FileInfo{
Name: "foo",
Type: FileInfoTypeDirectory,
Size: SyntheticDirectorySize,
},
ok: true,
},
{
// directory with arbitrary size
fi: FileInfo{
Name: "foo",
Type: FileInfoTypeDirectory,
Size: 42,
},
ok: false,
},
{
// symlink with zero size
fi: FileInfo{
Name: "foo",
Type: FileInfoTypeSymlink,
SymlinkTarget: []byte("bar"),
},
ok: true,
},
{
// symlink with synthetic directory size (not permitted)
fi: FileInfo{
Name: "foo",
Type: FileInfoTypeSymlink,
SymlinkTarget: []byte("bar"),
Size: SyntheticDirectorySize,
},
ok: false,
},
{
// symlink with arbitrary size
fi: FileInfo{
Name: "foo",
Type: FileInfoTypeSymlink,
SymlinkTarget: []byte("bar"),
Size: 42,
},
ok: false,
},
}
for _, tc := range cases {