Fixed export of entities, if their name contained slash or other reserved charcters

This commit is contained in:
Jan Böhmer 2024-01-29 21:25:30 +01:00
parent 2f17d5f3f5
commit fb493cc837
2 changed files with 60 additions and 0 deletions

View file

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace App\Services\ImportExportSystem;
use App\Entity\Base\AbstractNamedDBElement;
use App\Helpers\FilenameSanatizer;
use Symfony\Component\OptionsResolver\OptionsResolver;
use InvalidArgumentException;
use function is_array;
@ -166,6 +167,9 @@ class EntityExporter
$filename = 'export_'.$entity_name.'_'.$level.'.'.$format;
//Sanitize the filename
$filename = FilenameSanatizer::sanitizeFilename($filename);
// Create the disposition of the file
$disposition = $response->headers->makeDisposition(
ResponseHeaderBag::DISPOSITION_ATTACHMENT,