From 8413f05f0483642930866baaa3315752b94774a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Tue, 8 Sep 2026 20:15:49 +0200 Subject: [PATCH] Report cleanup failures on the upload directory itself --- main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 2b80b50..acad1e5 100644 --- a/main.go +++ b/main.go @@ -796,6 +796,12 @@ func collectExpiredFiles(root string, duration time.Duration) ([]string, error) err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { if err != nil { + // A failure on root itself means the sweep saw nothing at all — an + // unmounted or unreadable volume — so let it reach the caller + // instead of logging it as one more skipped path. + if path == root { + return err + } log.Printf("Cleanup: skipping %q: %v", path, err) return nil } @@ -825,8 +831,13 @@ func collectEmptyDirs(root string) ([]string, error) { err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { // d is nil when the root itself cannot be read, so this check must - // come first. + // come first. That case also means the sweep saw nothing at all — an + // unmounted or unreadable volume — so let it reach the caller instead + // of logging it as one more skipped path. if err != nil { + if path == root { + return err + } log.Printf("Cleanup: skipping %q: %v", path, err) return nil }