Consider prefix rules when pruning WebDAV storages (#79)

This commit is contained in:
Frederik Ring 2022-03-05 13:33:15 +01:00 committed by GitHub
parent 4b1127b8c4
commit 5f3832d621
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ import (
"os"
"path"
"path/filepath"
"strings"
"text/template"
"time"
@ -580,6 +581,9 @@ func (s *script) pruneBackups() error {
var matches []fs.FileInfo
var lenCandidates int
for _, candidate := range candidates {
if !strings.HasPrefix(candidate.Name(), s.c.BackupPruningPrefix) {
continue
}
lenCandidates++
if candidate.ModTime().Before(deadline) {
matches = append(matches, candidate)