Skip to content

Commit

Permalink
BugFix: /kb or /kb list does not filter out unrelated files.
Browse files Browse the repository at this point in the history
  • Loading branch information
keuin committed Jan 29, 2021
1 parent 602fb9e commit cc69d50
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;

public class BackupNameSuggestionProvider {

Expand Down Expand Up @@ -34,8 +36,10 @@ public static void updateCandidateList() {
File[] files = file.listFiles();
if (files == null)
return;
for (File f : files)
candidateCacheList.add(f.getName());
Arrays.stream(files).map(File::getName).filter(
((Predicate<String>) s -> s.toLowerCase().endsWith(".zip"))
.or(s -> s.toLowerCase().endsWith(".kbi"))
).forEach(candidateCacheList::add);
cacheUpdateTime = (int) System.currentTimeMillis();
} catch (NullPointerException ignored) {
}
Expand Down

0 comments on commit cc69d50

Please sign in to comment.