Fix regression w/empty strings with KeywordReplacer (#5378)

This commit is contained in:
Josh Roy 2023-06-02 18:54:30 -04:00 committed by GitHub
parent fc3dabf8f5
commit 8d07c4bb0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -142,7 +142,7 @@ public class KeywordReplacer implements IText {
String line = input.getLines().get(i);
// Skip processing b64 encoded items, they will not have keywords in them.
if (line.charAt(0) == '@') {
if (line.startsWith("@")) {
replaced.add(line);
continue;
}
@ -383,7 +383,7 @@ public class KeywordReplacer implements IText {
if (this.replaceSpacesWithUnderscores) {
// Don't replace spaces with underscores in command nor escape underscores.
if (line.charAt(0) != '/') {
if (line.startsWith("/")) {
replacer = replacer.replace("_", "\\_").replaceAll("\\s", "_");
}
}