Fix FUSE attachment sizes and item filenames

This commit is contained in:
Jan Bader
2026-07-13 23:07:30 +02:00
parent d57724151a
commit 621fbe4913
3 changed files with 58 additions and 15 deletions
+6 -6
View File
@@ -18,7 +18,7 @@ func TestBuildMountTreeGroupsByFolderAndDate(t *testing.T) {
Attachments: []ItemAttachment{{ID: "att-1", Name: "invoice.pdf", Size: 123}},
}}
root := buildMountTree(&DocspellClient{}, items)
root := buildMountTree(context.Background(), &DocspellClient{}, items)
folder, ok := root.children["Bills_Private"].(*dirNode)
if !ok {
t.Fatalf("expected sanitized folder directory, got %#v", root.children)
@@ -31,8 +31,8 @@ func TestBuildMountTreeGroupsByFolderAndDate(t *testing.T) {
if !ok {
t.Fatalf("expected month directory, got %#v", year.children)
}
if _, ok := month.children["invoice.pdf"].(*fileNode); !ok {
t.Fatalf("expected attachment file, got %#v", month.children)
if _, ok := month.children["Invoice_July.pdf"].(*fileNode); !ok {
t.Fatalf("expected item-named attachment file, got %#v", month.children)
}
}
@@ -46,13 +46,13 @@ func TestBuildMountTreeDeduplicatesAttachmentNames(t *testing.T) {
},
}}
root := buildMountTree(&DocspellClient{}, items)
root := buildMountTree(context.Background(), &DocspellClient{}, items)
folder := root.children["No Folder"].(*dirNode)
date := folder.children["No Date"].(*dirNode)
if _, ok := date.children["Invoice - 01 - same.pdf"]; !ok {
if _, ok := date.children["Invoice - 01.pdf"]; !ok {
t.Fatalf("expected first unique name, got %#v", date.children)
}
if _, ok := date.children["Invoice - 02 - same.pdf"]; !ok {
if _, ok := date.children["Invoice - 02.pdf"]; !ok {
t.Fatalf("expected second unique name, got %#v", date.children)
}
}