Fix cleanup routine to reset state each cycle and skip removing upload root

This commit is contained in:
2026-08-29 00:42:23 +02:00
parent c0b4fa2617
commit 5fcd2b4473
+5
View File
@@ -395,6 +395,9 @@ func cleanupProcedure(duration time.Duration, dryRun bool) {
if !d.IsDir() {
return nil
}
if filepath.Clean(path) == filepath.Clean(uploadDir) {
return nil
}
empty, err := isDirEmpty(path)
if empty {
emptyDirs = append(emptyDirs, path)
@@ -406,6 +409,8 @@ func cleanupProcedure(duration time.Duration, dryRun bool) {
}
for {
oldFiles = oldFiles[:0]
emptyDirs = emptyDirs[:0]
filepath.WalkDir(uploadDir, deleteIfTooOld)
for _, file := range oldFiles {