Support \r-terminated files better from the Importer (#5184)

* Hoist the ini_get/ini_set auto-detect line endings code higher

* Placate the irascible Codacy
This commit is contained in:
Brady Wetherington
2018-03-13 20:06:53 -07:00
committed by snipe
parent 06e760081c
commit e15f2ac8ab
2 changed files with 6 additions and 4 deletions
@@ -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