From 8d698b4aec2be91fe1e47ba71ba258acbf23357d Mon Sep 17 00:00:00 2001 From: Wout <148221256+wout-o@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:24:00 +0100 Subject: [PATCH] Update allowed_protocols config for compatibility with Dompdf v3.1 (#1071) --- config/dompdf.php | 1 + tests/PdfTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/config/dompdf.php b/config/dompdf.php index c37e402..35eef8f 100644 --- a/config/dompdf.php +++ b/config/dompdf.php @@ -91,6 +91,7 @@ * @var array */ 'allowed_protocols' => [ + 'data://' => ['rules' => []], 'file://' => ['rules' => []], 'http://' => ['rules' => []], 'https://' => ['rules' => []], diff --git a/tests/PdfTest.php b/tests/PdfTest.php index 5f87da3..93b90d1 100644 --- a/tests/PdfTest.php +++ b/tests/PdfTest.php @@ -163,4 +163,14 @@ public function testMultipleInstances(): void $this->assertEquals('host1', $pdf1->getDomPDF()->getBaseHost()); $this->assertEquals('host2', $pdf2->getDomPDF()->getBaseHost()); } + + public function testDataImage(): void + { + $pdf = Facade\Pdf::loadHTML(''); + $response = $pdf->download('test.pdf'); + + $this->assertInstanceOf(Response::class, $response); + $this->assertNotEmpty($response->getContent()); + $this->assertEquals(1424, strlen($response->getContent())); + } }