From 86ceea054f5f85157b04473bac5bfb6ff86ca31f Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 25 May 2017 14:52:42 +0200 Subject: Add a whitelist of protocols for URLs - for Shaare - for markdown description links and images Not whitelisted protocols will be replaced by `http://` --- tests/plugins/PluginMarkdownTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tests/plugins/PluginMarkdownTest.php') diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index d8180ad6..96891f1f 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php @@ -26,6 +26,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase { PluginManager::$PLUGINS_PATH = 'plugins'; $this->conf = new ConfigManager('tests/utils/config/configJson'); + $this->conf->set('security.allowed_protocols', ['ftp', 'magnet']); } /** @@ -183,15 +184,19 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase } /** - * Test hashtag links processed with markdown. + * Make sure that the generated HTML match the reference HTML file. */ - public function testMarkdownHashtagLinks() + public function testMarkdownGlobalProcessDescription() { $md = file_get_contents('tests/plugins/resources/markdown.md'); $md = format_description($md); $html = file_get_contents('tests/plugins/resources/markdown.html'); - $data = process_markdown($md); + $data = process_markdown( + $md, + $this->conf->get('security.markdown_escape', true), + $this->conf->get('security.allowed_protocols') + ); $this->assertEquals($html, $data); } -- cgit v1.2.3