diff --git a/app/Http/Controllers/Api/ImportController.php b/app/Http/Controllers/Api/ImportController.php index 1cda09c20e..f1c273b484 100644 --- a/app/Http/Controllers/Api/ImportController.php +++ b/app/Http/Controllers/Api/ImportController.php @@ -72,6 +72,9 @@ class ImportController extends Controller $import->file_path = $file_name; $import->filesize = filesize($path.'/'.$file_name); //TODO: is there a lighter way to do this? + if (! ini_get("auto_detect_line_endings")) { + ini_set("auto_detect_line_endings", '1'); + } $reader = Reader::createFromPath("{$path}/{$file_name}"); $import->header_row = $reader->fetchOne(0); // Grab the first row to display via ajax as the user picks fields diff --git a/app/Importer/Importer.php b/app/Importer/Importer.php index e73ef1eed9..e74d3607ea 100644 --- a/app/Importer/Importer.php +++ b/app/Importer/Importer.php @@ -91,15 +91,14 @@ abstract class Importer $this->fieldMap = $this->defaultFieldMap; // By default the importer passes a url to the file. // However, for testing we also support passing a string directly + if (! ini_get("auto_detect_line_endings")) { + ini_set("auto_detect_line_endings", '1'); + } if (is_file($file)) { $this->csv = Reader::createFromPath($file); } else { $this->csv = Reader::createFromString($file); } - $this->csv->setNewLine('\r\n'); - if (! ini_get("auto_detect_line_endings")) { - ini_set("auto_detect_line_endings", '1'); - } $this->tempPassword = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20); } // Cached Values for import lookups