mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-07 17:40:57 +00:00
parent
c653618eab
commit
6c66a8935a
2 changed files with 18 additions and 0 deletions
|
@ -139,6 +139,7 @@ class PageRepo extends EntityRepo
|
||||||
if ($htmlText == '') {
|
if ($htmlText == '') {
|
||||||
return $htmlText;
|
return $htmlText;
|
||||||
}
|
}
|
||||||
|
|
||||||
libxml_use_internal_errors(true);
|
libxml_use_internal_errors(true);
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
$doc->loadHTML(mb_convert_encoding($htmlText, 'HTML-ENTITIES', 'UTF-8'));
|
$doc->loadHTML(mb_convert_encoding($htmlText, 'HTML-ENTITIES', 'UTF-8'));
|
||||||
|
|
|
@ -159,4 +159,21 @@ class PageContentTest extends TestCase
|
||||||
$pageView = $this->get($pageB->getUrl());
|
$pageView = $this->get($pageB->getUrl());
|
||||||
$pageView->assertSuccessful();
|
$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…
Add table
Add a link
Reference in a new issue