From 44fb439578a1a2d190407fc21f52d143b34af915 Mon Sep 17 00:00:00 2001
From: Kevin Paxman <kpaxman@uwaterloo.ca>
Date: Tue, 20 Sep 2022 09:59:50 -0400
Subject: [PATCH] ISTWCMS-5754: make menu link CSV title CSV-safe, and use
 yes/no for 'has children'

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

diff --git a/src/Controller/UwDownloadCsvController.php b/src/Controller/UwDownloadCsvController.php
index 46cfdb40..d2009b78 100644
--- a/src/Controller/UwDownloadCsvController.php
+++ b/src/Controller/UwDownloadCsvController.php
@@ -315,15 +315,15 @@ class UwDownloadCsvController extends ControllerBase {
           }
         }
 
-        // Set the data about the menu link.
+        // Set the data about the menu link, making sure the title is CSV-safe.
         $data = [
           'menu_name' => $link->menu_name,
           'link_id' => $link->mlid,
           'parent_link_id' => $parent_id,
           'alias' => $alias,
           'link_path' => $link_url,
-          'title' => '"' . unserialize($link->title) . '"',
-          'has_children' => $link->has_children,
+          'title' => '"' . str_replace( '"', '""', unserialize($link->title)) . '"',
+          'has_children' => $link->has_children == 1 ? 'yes' : 'no',
           'p1' => $link->p1,
           'p2' => $link->p2,
           'p3' => $link->p3,
-- 
GitLab