From 33373be1863b6fe0565b9b716f0addbc5080122b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Tue, 8 Jul 2025 14:24:02 +0000 Subject: [PATCH] Fix FLEXIAPI-351 Fix import of CSV generated on Windows --- CHANGELOG.md | 1 + .../app/Http/Controllers/Admin/AccountImportController.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eccbe64..5cdc6c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ v2.0 - Fix FLEXIAPI-342 Enforce password change when the External Account domain is changed - Fix FLEXIAPI-346 Complete the supporting text for the provisioning ini field - Fix FLEXIAPI-350 Fix wrongly assigned variables in some views +- Fix FLEXIAPI-351 Fix import of CSV generated on Windows v1.6 ---- diff --git a/flexiapi/app/Http/Controllers/Admin/AccountImportController.php b/flexiapi/app/Http/Controllers/Admin/AccountImportController.php index 3b14223..4724273 100644 --- a/flexiapi/app/Http/Controllers/Admin/AccountImportController.php +++ b/flexiapi/app/Http/Controllers/Admin/AccountImportController.php @@ -67,7 +67,9 @@ class AccountImportController extends Controller $lines = collect(); $this->errors['Wrong file format'] = "The number of columns doesn't matches the reference file. The first MUST be the same as the reference file"; - if ($line == "Username,Password,Role,Status,Phone,Email,External Username,External Domain,External Password,External Realm, External Registrar,External Outbound Proxy,External Protocol\n") { + $firstLine = 'Username,Password,Role,Status,Phone,Email,External Username,External Domain,External Password,External Realm, External Registrar,External Outbound Proxy,External Protocol'; + + if (substr($line, 0, strlen($firstLine)) == $firstLine) { $lines = $this->csvToCollection($request->file('csv')); unset($this->errors['Wrong file format']); }