Completely strip CRLF characters from expression result (and don't just replace with newline)

@see https://www.filebot.net/forums/viewtopic.php?f=10&t=5390
This commit is contained in:
Reinhard Pointner 2017-10-12 23:30:59 +02:00
parent c1f1cfd4f1
commit dedc1d73b3
1 changed files with 6 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package net.filebot.format;
import static net.filebot.similarity.Normalization.*; import static net.filebot.similarity.Normalization.*;
import static net.filebot.util.FileUtilities.*; import static net.filebot.util.FileUtilities.*;
import static net.filebot.util.RegularExpressions.*;
import javax.script.Bindings; import javax.script.Bindings;
import javax.script.ScriptException; import javax.script.ScriptException;
@ -36,7 +37,11 @@ public class ExpressionFileFormat extends ExpressionFormat {
@Override @Override
protected String normalizeResult(CharSequence value) { protected String normalizeResult(CharSequence value) {
// normalize unicode space characters and remove newline characters // normalize unicode space characters and remove newline characters
return normalizePathSeparators(replaceSpace(value, " ").trim()); return normalizePathSeparators(replaceSpace(stripCRLF(value), " ").trim());
}
protected String stripCRLF(CharSequence value) {
return NEWLINE.matcher(value).replaceAll("");
} }
} }