Fix FUSE reads for unknown attachment sizes

This commit is contained in:
Jan Bader
2026-07-13 23:03:41 +02:00
parent 2e0f0939b3
commit d57724151a
2 changed files with 40 additions and 3 deletions
+20 -1
View File
@@ -1,6 +1,11 @@
package main
import "testing"
import (
"context"
"testing"
"bazil.org/fuse"
)
func TestBuildMountTreeGroupsByFolderAndDate(t *testing.T) {
items := []SearchItem{{
@@ -51,3 +56,17 @@ func TestBuildMountTreeDeduplicatesAttachmentNames(t *testing.T) {
t.Fatalf("expected second unique name, got %#v", date.children)
}
}
func TestFileNodeUnknownSizeDoesNotAdvertiseZeroLength(t *testing.T) {
f := &fileNode{size: 0, knownSize: false}
var attr fuse.Attr
if err := f.Attr(context.Background(), &attr); err != nil {
t.Fatal(err)
}
if attr.Size != 0 {
t.Fatalf("expected absent size to remain zero, got %d", attr.Size)
}
if f.knownSize {
t.Fatal("expected unknown size before download")
}
}