mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-04 17:04:32 +08:00
Filtered scripts in custom HTML head for exports
Since it appeared to cause problems in some scenarios. Related to #2490
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
<?php namespace Tests\Entity;
|
||||
|
||||
use BookStack\Entities\Models\Book;
|
||||
use BookStack\Entities\Models\Chapter;
|
||||
use BookStack\Entities\Models\Page;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@ -214,4 +215,19 @@ class ExportTest extends TestCase
|
||||
$resp->assertSee('src="/uploads/svg_test.svg"');
|
||||
}
|
||||
|
||||
public function test_exports_removes_scripts_from_custom_head()
|
||||
{
|
||||
$entities = [
|
||||
Page::query()->first(), Chapter::query()->first(), Book::query()->first(),
|
||||
];
|
||||
setting()->put('app-custom-head', '<script>window.donkey = "cat";</script><style>.my-test-class { color: red; }</style>');
|
||||
|
||||
foreach ($entities as $entity) {
|
||||
$resp = $this->asEditor()->get($entity->getUrl('/export/html'));
|
||||
$resp->assertDontSee('window.donkey');
|
||||
$resp->assertDontSee('script');
|
||||
$resp->assertSee('.my-test-class { color: red; }');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user