-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 10.4.10
-
Fix Version/s: 10.5
-
Component/s: Course
-
Labels:None
-
Funded by:
When grading students, a teacher can add a comment. If he uses quotes in the comment, the exported CSV format is being broken. (Double) quotes has to replaced by two (double) quotes (" -> "" or ' -> '').
(https://de.wikipedia.org/wiki/CSV_%28Dateiformat%29)
This patch fixes the problem:
diff --git a/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java b/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java --- a/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java +++ b/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java @@ -300,8 +300,9 @@ if (comment != null) { // put comment between double quote in order to prevent that // '\t','\r' or '\n' destroy the excel table + // A (double) quote must be represented by two (double) quotes. tableContent.append("\""); - tableContent.append(comment); + tableContent.append(comment.replaceAll("\"", "\"\"")); tableContent.append("\"\t"); } else { tableContent.append(mi); @@ -320,8 +321,9 @@ if (coachComment != null) { // put coachComment between double quote in order to prevent that // '\t','\r' or '\n' destroy the excel table + // A (double) quote must be represented by two (double) quotes. tableContent.append("\""); - tableContent.append(coachComment); + tableContent.append(coachComment.replaceAll("\"", "\"\"")); tableContent.append("\"\t"); } else { tableContent.append(mi);