From 4a6a6ca9375a61fb037b8c8cf3dbea179d92b720 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 22 Feb 2015 20:06:13 +0100 Subject: [PATCH] Bugfix for spaces in links --- include/bbcode.php | 2 +- library/markdown.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/bbcode.php b/include/bbcode.php index d461b98482..1da9bf1d24 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -191,7 +191,7 @@ function bb_cleanup_share($shared, $plaintext, $nolink) { if (isset($bookmark[1][0])) $link = $bookmark[1][0]; - if (($title != "") AND (strpos($title, $shared[1]) !== false)) + if (($shared[1] != "") AND (strpos($title, $shared[1]) !== false)) $shared[1] = $title; if (($title != "") AND ((strpos($shared[1],$title) !== false) OR diff --git a/library/markdown.php b/library/markdown.php index 271d2e36c6..83082f7ca7 100644 --- a/library/markdown.php +++ b/library/markdown.php @@ -2,6 +2,11 @@ require_once("library/parsedown/Parsedown.php"); function Markdown($text) { + + // Bugfix for the library: + // "[Title](http://domain.tld/ )" isn't handled correctly + $text = preg_replace("/\[(.*?)\]\s*?\(\s*?(\S*?)\s*?\)/ism", '[$1]($2)', $text); + $Parsedown = new Parsedown(); return($Parsedown->text($text)); }