From 4f7569d941e4b69c64738528497732908eaac7f6 Mon Sep 17 00:00:00 2001 From: JediKev <kevin@enhancesoft.com> Date: Mon, 18 Nov 2019 13:25:56 -0600 Subject: [PATCH] format: Clickable URLs This addresses issue 5176 where some Plaintext URLs are not completely clickable. This is due to the regex check for clickable URLs not including a few characters. This adds `[`, `]`, and `/` as matchable characters so urls like `https://test.com/cart/add?route=marketplace/extension/info&product[123]=3` will be completely clickable. --- include/class.format.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/class.format.php b/include/class.format.php index bbacfd68d..7370e62b3 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -465,7 +465,7 @@ class Format { function($match) { // Scan for things that look like URLs return preg_replace_callback( - '`(?<!>)(((f|ht)tp(s?)://|(?<!//)www\.)([-+~%/.\w]+)(?:[-?#+=&;%@.\w]*)?)' + '`(?<!>)(((f|ht)tp(s?)://|(?<!//)www\.)([-+~%/.\w]+)(?:[-?#+=&;%@.\w\[\]\/]*)?)' .'|(\b[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,63})`', function ($match) { if ($match[1]) { -- GitLab