mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-20 03:09:37 +03:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1db1083064 | ||
|
|
664eb6d980 | ||
|
|
80204518a2 |
@@ -103,7 +103,13 @@ class HtmlDocument
|
||||
*/
|
||||
public function getBody(): DOMNode
|
||||
{
|
||||
return $this->document->getElementsByTagName('body')[0];
|
||||
$bodies = $this->document->getElementsByTagName('body');
|
||||
|
||||
if ($bodies->length === 0) {
|
||||
return new DOMElement('body', '');
|
||||
}
|
||||
|
||||
return $bodies[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1 +1 @@
|
||||
9a9b39ad13bada8f7c71e2224593d37c967b4ebe5ec048877cd30ca3ff33d898
|
||||
8e88c0fe2ea1b1bb500f6cd10cf3fcf04198e2d55fe71f292d091d4faa6eb7f3
|
||||
@@ -282,4 +282,23 @@ class PageEditorTest extends TestCase
|
||||
$resp->assertOk();
|
||||
$resp->assertDontSee('hellotherethisisaturtlemonster', false);
|
||||
}
|
||||
|
||||
public function test_editor_html_filtered_does_not_cause_error_if_empty()
|
||||
{
|
||||
$emptyExamples = ['', '<p></p>', '<p> </p>', ' ', "\n"];
|
||||
$editor = $this->users->editor();
|
||||
$page = $this->entities->page();
|
||||
$page->updated_by = $editor->id;
|
||||
|
||||
foreach ($emptyExamples as $emptyExample) {
|
||||
$page->html = $emptyExample;
|
||||
$page->save();
|
||||
|
||||
$resp = $this->asAdmin()->get($page->getUrl('edit'));
|
||||
$resp->assertOk();
|
||||
|
||||
$resp = $this->asAdmin()->get("/ajax/page/{$page->id}");
|
||||
$resp->assertOk();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user