From b598ddc00ee9795b0b9a5be270dcfb04861e1ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Hrdina?= Date: Wed, 30 Jan 2019 10:10:28 +0000 Subject: [PATCH 1/2] wrap original filename in cdata element when storing it to database. --- bundle/FieldHandler/EnhancedBinaryFileHandler.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bundle/FieldHandler/EnhancedBinaryFileHandler.php b/bundle/FieldHandler/EnhancedBinaryFileHandler.php index 3175ca2..6189e27 100644 --- a/bundle/FieldHandler/EnhancedBinaryFileHandler.php +++ b/bundle/FieldHandler/EnhancedBinaryFileHandler.php @@ -80,7 +80,9 @@ protected function store(EnhancedBinaryFileValue $value, FieldDefinition $fieldD ]; foreach ($fileInfo as $key => $binaryFileItem) { - $binaryFileElement = $doc->createElement($key, $binaryFileItem); + $cdataElement = $doc->createCDATASection($binaryFileItem); + $binaryFileElement = $doc->createElement($key); + $binaryFileElement->appendChild($cdataElement); $binaryFileList->appendChild($binaryFileElement); } From 98b7fb563055b91355c00311ffb0b1076aafa0a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Hrdina?= Date: Wed, 30 Jan 2019 10:11:35 +0000 Subject: [PATCH 2/2] reverse htmlentities call used when storing the filename to restore original filename --- bundle/Controller/DownloadController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle/Controller/DownloadController.php b/bundle/Controller/DownloadController.php index 2acdaaf..a30a714 100644 --- a/bundle/Controller/DownloadController.php +++ b/bundle/Controller/DownloadController.php @@ -82,7 +82,7 @@ public function downloadCollectedEnhancedEzBinaryFileAction($infocollectionAttri $filePath = $filePathNodes->item(0)->textContent; $fileName = basename($filePath); - $originalFilename = $originalFilenameNodes->length ? $originalFilenameNodes->item(0)->textContent : $fileName; + $originalFilename = html_entity_decode($originalFilenameNodes->length ? $originalFilenameNodes->item(0)->textContent : $fileName); $binaryFile = $this->ioService->loadBinaryFile('collected' . \DIRECTORY_SEPARATOR . $fileName);