fix(05): WR-05 gate public file serving on is_public

This commit is contained in:
Jakub Zych
2026-09-19 15:37:04 +02:00
parent c12e6576f6
commit 56156ae7c3
5 changed files with 195 additions and 0 deletions

View File

@@ -37,6 +37,19 @@ func TestFileIsPublicDefaultsTrue(t *testing.T) {
}
}
func TestThumbFileID(t *testing.T) {
id, ok := thumbFileID("thumb_42_200_200_0_0_crop.jpg")
if !ok || id != 42 {
t.Fatalf("thumb id = %d ok=%v, want 42 true", id, ok)
}
if _, ok := thumbFileID("abc123xyz.jpg"); ok {
t.Fatal("original disk_name must not parse as a thumb id")
}
if _, ok := thumbFileID("thumb_x_200_200_0_0_crop.jpg"); ok {
t.Fatal("non-numeric thumb id must be rejected")
}
}
func TestFileSelfRegisters(t *testing.T) {
for _, m := range All() {
switch m.(type) {