From dedc1d73b3121b4c086b74d1db83e147530f2d07 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 12 Oct 2017 23:30:59 +0200 Subject: [PATCH] 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 --- source/net/filebot/format/ExpressionFileFormat.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/net/filebot/format/ExpressionFileFormat.java b/source/net/filebot/format/ExpressionFileFormat.java index 9e78b495..5d20e083 100644 --- a/source/net/filebot/format/ExpressionFileFormat.java +++ b/source/net/filebot/format/ExpressionFileFormat.java @@ -2,6 +2,7 @@ package net.filebot.format; import static net.filebot.similarity.Normalization.*; import static net.filebot.util.FileUtilities.*; +import static net.filebot.util.RegularExpressions.*; import javax.script.Bindings; import javax.script.ScriptException; @@ -36,7 +37,11 @@ public class ExpressionFileFormat extends ExpressionFormat { @Override protected String normalizeResult(CharSequence value) { // 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(""); } }