Fix FUSE reads for unknown attachment sizes
This commit is contained in:
+20
-1
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user