From bd045b0d032d7042fb6bd0be6a6ff29d9ff540cb Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 6 Dec 2021 10:57:42 +0100 Subject: [PATCH] SEBSERV-252 fixed CSV export escaping --- src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java b/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java index 4d0c4671..c818f145 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java @@ -678,7 +678,11 @@ public final class Utils { if (StringUtils.isBlank(text)) { return StringUtils.EMPTY; } - return Constants.DOUBLE_QUOTE + text.replace("\"", "\"\"") + Constants.DOUBLE_QUOTE; + return Constants.DOUBLE_QUOTE + + text + .replace("\r\n", "\n") + .replace("\"", "\"\"") + + Constants.DOUBLE_QUOTE; } }