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
+6 -2
View File
@@ -640,8 +640,12 @@ func checkFileInfoConsistency(f FileInfo) error {
// Only files should have blocks
return errNonFileHasBlocks
case f.Type != FileInfoTypeFile && f.Size != 0:
// Only files should have a size
case f.IsDirectory() && f.Size != 0 && f.Size != SyntheticDirectorySize:
// Directories should be size zero or the synthetic directory size
return errNonFileHasSize
case f.IsSymlink() && f.Size != 0:
// Symlinks should be size zero
return errNonFileHasSize
case !f.Deleted && !f.IsInvalid() && f.Type == FileInfoTypeFile && len(f.Blocks) == 0: