Make doubly sure special characters are removed from the notes.

This commit is contained in:
James Cole 2022-10-16 15:18:11 +02:00
parent 69929bee31
commit a74d345ac2
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
2 changed files with 7 additions and 1 deletions

View File

@ -50,6 +50,7 @@ use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use FireflyIII\Repositories\Rule\RuleRepositoryInterface; use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface; use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface; use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use League\Csv\CannotInsertRecord; use League\Csv\CannotInsertRecord;
@ -61,6 +62,8 @@ use League\Csv\Writer;
*/ */
class ExportDataGenerator class ExportDataGenerator
{ {
use ConvertsDataTypes;
private const ADD_RECORD_ERR = 'Could not add record to set: %s'; private const ADD_RECORD_ERR = 'Could not add record to set: %s';
private const EXPORT_ERR = 'Could not export to string: %s'; private const EXPORT_ERR = 'Could not export to string: %s';
private Collection $accounts; private Collection $accounts;
@ -698,7 +701,7 @@ class ExportDataGenerator
$journal['budget_name'], $journal['budget_name'],
$journal['bill_name'], $journal['bill_name'],
$this->mergeTags($journal['tags']), $this->mergeTags($journal['tags']),
$journal['notes'], $this->clearString($journal['notes'], true),
// export also the optional fields (ALL) // export also the optional fields (ALL)

View File

@ -68,6 +68,9 @@ trait ConvertsDataTypes
return null; return null;
} }
$search = [ $search = [
"\0", // NUL
"\f", // form feed
"\v", // vertical tab
"\u{0001}", // start of heading "\u{0001}", // start of heading
"\u{0002}", // start of text "\u{0002}", // start of text
"\u{0003}", // end of text "\u{0003}", // end of text