Skip to content

Commit a665aa7

Browse files
committed
tags from config sanitized
1 parent 3089083 commit a665aa7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

application/src/main/java/org/togetherjava/tjbot/features/help/HelpSystemHelper.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,12 @@ public HelpSystemHelper(Config config, Database database, ChatGptService chatGpt
108108
.map(ThreadActivity::getTagName)
109109
.collect(Collectors.toSet());
110110

111-
List<String> tagsToIgnoreList = helpConfig.getTagsToIgnore();
111+
// tagsToIgnore list values are sanitized to avoid any config mismatch due to human error
112+
List<String> tagsToIgnoreList = helpConfig.getTagsToIgnore()
113+
.stream()
114+
.map(String::toLowerCase)
115+
.map(String::strip)
116+
.toList();
112117
tagsToIgnore = new HashSet<>(tagsToIgnoreList);
113118

114119
}
@@ -424,6 +429,6 @@ Optional<Long> getAuthorByHelpThreadId(final long channelId) {
424429
* @return boolean result whether to ignore this tag or not
425430
*/
426431
boolean shouldIgnoreTag(ForumTag tag) {
427-
return !this.tagsToIgnore.contains(tag.getName());
432+
return !this.tagsToIgnore.contains(tag.getName().toLowerCase());
428433
}
429434
}

0 commit comments

Comments
 (0)