fix handling of maxKeys in SearchKey

This commit is contained in:
Jayson Wang
2022-05-30 15:54:32 +08:00
committed by Michael Eischer
parent 1dd4b9b60e
commit f144920ed5
2 changed files with 11 additions and 0 deletions

View File

@@ -137,6 +137,7 @@ func SearchKey(ctx context.Context, s *Repository, password string, maxKeys int,
// try at most maxKeys keys in repo
err = s.Backend().List(listCtx, restic.KeyFile, func(fi restic.FileInfo) error {
checked++
if maxKeys > 0 && checked > maxKeys {
return ErrMaxKeysReached
}