mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-03-24 15:15:14 +08:00
parent
c653618eab
commit
6c66a8935a
@ -139,6 +139,7 @@ class PageRepo extends EntityRepo
|
||||
if ($htmlText == '') {
|
||||
return $htmlText;
|
||||
}
|
||||
|
||||
libxml_use_internal_errors(true);
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadHTML(mb_convert_encoding($htmlText, 'HTML-ENTITIES', 'UTF-8'));
|
||||
|
@ -159,4 +159,21 @@ class PageContentTest extends TestCase
|
||||
$pageView = $this->get($pageB->getUrl());
|
||||
$pageView->assertSuccessful();
|
||||
}
|
||||
|
||||
public function test_duplicate_ids_fixed_on_page_save()
|
||||
{
|
||||
$this->asEditor();
|
||||
$page = Page::first();
|
||||
|
||||
$content = '<p id="bkmrk-test">test a</p>'."\n".'<p id="bkmrk-test">test b</p>';
|
||||
$pageSave = $this->put($page->getUrl(), [
|
||||
'name' => $page->name,
|
||||
'html' => $content,
|
||||
'summary' => ''
|
||||
]);
|
||||
$pageSave->assertRedirect();
|
||||
|
||||
$updatedPage = Page::where('id', '=', $page->id)->first();
|
||||
$this->assertEquals(substr_count($updatedPage->html, "bkmrk-test\""), 1);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user