From 4fb9d3b41541263880af54087595e05b4b121d1f Mon Sep 17 00:00:00 2001
From: Pravin Ajaaz <Pravin Ajaaz@2910049.no-reply.drupal.org>
Date: Wed, 5 Aug 2015 20:10:39 -0700
Subject: [PATCH] Issue #2397151 by Pravin Ajaaz: importer UI for CSVs should
 quote column names that contain commas

---
 plugins/FeedsCSVParser.inc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/plugins/FeedsCSVParser.inc b/plugins/FeedsCSVParser.inc
index 04d79b67..c6f11cd9 100644
--- a/plugins/FeedsCSVParser.inc
+++ b/plugins/FeedsCSVParser.inc
@@ -123,7 +123,12 @@ class FeedsCSVParser extends FeedsParser {
     $mappings = feeds_importer($this->id)->processor->config['mappings'];
     $sources = $uniques = array();
     foreach ($mappings as $mapping) {
-      $sources[] = check_plain($mapping['source']);
+      if (strpos($mapping['source'], ',') !== FALSE) {
+        $sources[] = '"' . check_plain($mapping['source']) . '"';
+      }
+      else {
+        $sources[] = check_plain($mapping['source']);
+      }
       if (!empty($mapping['unique'])) {
         $uniques[] = check_plain($mapping['source']);
       }
-- 
GitLab