Skip to content

NOW MANAGED ON CODEBERG

Moved decode and updated page plaintext decode test

Dan Brown31eec34b5d09
diff --git a/app/Entities/Managers/PageContent.php b/app/Entities/Managers/PageContent.php
index 96399f91f..e417b1caa 100644
--- a/app/Entities/Managers/PageContent.php
+++ b/app/Entities/Managers/PageContent.php
@@ -25,7 +25,7 @@ class PageContent
public function setNewHTML(string $html)
{
$this->page->html = $this->formatHtml($html);
- $this->page->text = html_entity_decode($this->toPlainText());
+ $this->page->text = $this->toPlainText();
}
/**
@@ -108,7 +108,7 @@ class PageContent
protected function toPlainText(): string
{
$html = $this->render(true);
- return strip_tags($html);
+ return html_entity_decode(strip_tags($html));
}
/**
diff --git a/tests/Entity/PageContentTest.php b/tests/Entity/PageContentTest.php
index 7aeaf0012..d3b6224c4 100644
--- a/tests/Entity/PageContentTest.php
+++ b/tests/Entity/PageContentTest.php
@@ -312,10 +312,10 @@ class PageContentTest extends TestCase
$this->actingAs($this->getAdmin())
->put($page->getUrl(''), [
'name' => 'Testing',
- 'html' => '<p>Hello &amp; welcome</p>',
+ 'html' => '<p>&quot;Hello &amp; welcome&quot;</p>',
]);
$page->refresh();
- $this->assertEquals('Hello & welcome', $page->text);
+ $this->assertEquals('"Hello & welcome"', $page->text);
}
}