aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-10-12 17:08:15 +0000
committerMario <mario@mariovavti.com>2024-10-12 17:08:15 +0000
commite9dc4b553b5fa2f4cfa0530fc2ee70305104a3c6 (patch)
treed57ac2ba6539debabc26c798751cde774387ee10
parentc70bd08c10405c3a3b55a3d1a49c931b2fefbc3d (diff)
downloadvolse-hubzilla-e9dc4b553b5fa2f4cfa0530fc2ee70305104a3c6.tar.gz
volse-hubzilla-e9dc4b553b5fa2f4cfa0530fc2ee70305104a3c6.tar.bz2
volse-hubzilla-e9dc4b553b5fa2f4cfa0530fc2ee70305104a3c6.zip
Fix regex to detect URLs in cleanup_bbcode.
This fixes the issue where the text after the URL would be included in the link if it was immediately followed by a newline. Example: https://example.com this is a test. Would become: #^[url=https://example.com_this]https://example.com_this[/url] is a test (cherry picked from commit 687cda367316edb9f84b3e425e76c9e9279e96be) Co-authored-by: Harald Eilertsen <haraldei@anduin.net>
-rw-r--r--include/text.php7
1 files changed, 2 insertions, 5 deletions
diff --git a/include/text.php b/include/text.php
index 137622b7d..e69ce7d10 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3755,12 +3755,9 @@ function cleanup_bbcode($body) {
$body = preg_replace_callback('/\[img(.*?)\[\/(img)\]/ism','\red_escape_codeblock',$body);
$body = preg_replace_callback('/\[zmg(.*?)\[\/(zmg)\]/ism','\red_escape_codeblock',$body);
- $body = preg_replace_callback("/([^\]\='".'"'."\;\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
-+\,\(\)]+)/ismu", '\nakedoembed', $body);
-
- $body = preg_replace_callback("/([^\]\='".'"'."\;\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
-+\,\(\)]+)/ismu", '\red_zrl_callback', $body);
+ $body = preg_replace_callback("/([^\]\='".'"'."\;\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\+\,\(\)]+)/ismu", '\nakedoembed', $body);
+ $body = preg_replace_callback("/([^\]\='".'"'."\;\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\+\,\(\)]+)/ismu", '\red_zrl_callback', $body);
$body = preg_replace_callback('/\[\$b64code(.*?)\[\/(code)\]/ism','\red_unescape_codeblock',$body);
$body = preg_replace_callback('/\[\$b64summary(.*?)\[\/(summary)\]/ism','\red_unescape_codeblock',$body);