From: Michael Date: Thu, 14 Sep 2017 22:04:37 +0000 (+0000) Subject: Improved regular expression for the Diaspora link detection X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d10eaefaa967c3f024acb4b66f40e6bce86700d7;p=friendica.git Improved regular expression for the Diaspora link detection --- diff --git a/include/bbcode.php b/include/bbcode.php index be4667a298..a14e3ee8e9 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -987,7 +987,8 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa // Server independent link to posts and comments // See issue: https://github.com/diaspora/diaspora_federation/issues/75 - $Text = preg_replace("=diaspora://(.*?)/([^\s\]]*)=ism", System::baseUrl()."/display/$2", $Text); + $expression = "=diaspora://.*?/post/([0-9A-Za-z\-_@.:]{15,254}[0-9A-Za-z])=ism"; + $Text = preg_replace($expression, System::baseUrl()."/display/$1", $Text); // if the HTML is used to generate plain text, then don't do this search, but replace all URL of that kind to text // if ($simplehtml != 7) {