From 6c09334ba07e6ca76405311aea816991081fb4c2 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 6 Dec 2020 22:23:21 +0000 Subject: [PATCH] Fixed issue where page export contain system would miss images --- app/Entities/Tools/ExportFormatter.php | 2 +- tests/Entity/ExportTest.php | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/Entities/Tools/ExportFormatter.php b/app/Entities/Tools/ExportFormatter.php index 92469a9b0..9cf8b56af 100644 --- a/app/Entities/Tools/ExportFormatter.php +++ b/app/Entities/Tools/ExportFormatter.php @@ -143,7 +143,7 @@ class ExportFormatter protected function containHtml(string $htmlContent): string { $imageTagsOutput = []; - preg_match_all("/\/i", $htmlContent, $imageTagsOutput); + preg_match_all("/\/i", $htmlContent, $imageTagsOutput); // Replace image src with base64 encoded image strings if (isset($imageTagsOutput[0]) && count($imageTagsOutput[0]) > 0) { diff --git a/tests/Entity/ExportTest.php b/tests/Entity/ExportTest.php index 7c56a7268..1e44f015a 100644 --- a/tests/Entity/ExportTest.php +++ b/tests/Entity/ExportTest.php @@ -167,12 +167,28 @@ class ExportTest extends TestCase $resp->assertSee(''; + $page->save(); + + $resp = $this->asEditor()->get($page->getUrl('/export/html')); + Storage::disk('local')->delete('uploads/images/gallery/svg_test.svg'); + Storage::disk('local')->delete('uploads/images/gallery/svg_test2.svg'); + + $resp->assertDontSee('http://localhost/uploads/images/gallery/svg_test'); + } + public function test_page_export_contained_html_image_fetches_only_run_when_url_points_to_image_upload_folder() { $page = Page::first(); $page->html = '' - ."\n".'' - ."\n".''; + .'' + .''; $storageDisk = Storage::disk('local'); $storageDisk->makeDirectory('uploads/images/gallery'); $storageDisk->put('uploads/images/gallery/svg_test.svg', 'good');