From c5193bee9e6474e4052338887cef9811a2913d3d Mon Sep 17 00:00:00 2001
From: Kevin Paxman <kpaxman@uwaterloo.ca>
Date: Mon, 19 Sep 2022 11:51:37 -0400
Subject: [PATCH] ISTWCMS-5753: ensure the title in the content report is
 CSV-safe

---
 src/Controller/UwDownloadCsvController.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Controller/UwDownloadCsvController.php b/src/Controller/UwDownloadCsvController.php
index 4d4ee164..58412d2c 100644
--- a/src/Controller/UwDownloadCsvController.php
+++ b/src/Controller/UwDownloadCsvController.php
@@ -90,10 +90,10 @@ class UwDownloadCsvController extends ControllerBase {
       // Step through each of the nodes and get the info.
       foreach ($nodes as $node) {
 
-        // Pull out the info about the node.
+        // Pull out the info about the node, making sure the title is CSV-safe.
         $data = [
           'nid' => $node->id(),
-          'title' => '"' . $node->getTitle() . '"',
+          'title' => '"' . str_replace('"', '""', $node->getTitle()) . '"',
           'type' => $node->type->entity->label(),
           'path' => $this->pathAlias->getAliasByPath('/node/' . $node->id()),
           'published' => $node->status->value == 1 ? 'yes' : 'no',
-- 
GitLab