Skip to content

Commit

Permalink
Improve linkify algorithm - closes #3402
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Dec 3, 2023
1 parent b33d2df commit e0f1067
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Misc/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ public static function linkify($value, $protocols = ['http', 'mail'], array $att
//$value = preg_replace_callback('~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i', function ($match) use ($protocol, &$links, $attr) {
//$value = preg_replace_callback('%(\b(([\w-]+)://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))%s', function ($match) use ($protocol, &$links, $attr) {
// https://github.com/freescout-helpdesk/freescout/issues/3402
$value = preg_replace_callback('%([>\r\n\s:; ]|^)((([\w-]+)://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))%s', function ($match) use ($protocol, &$links, $attr) {
$value = preg_replace_callback('%([>\r\n\s:;\( ]|^)((([\w-]+)://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))%s', function ($match) use ($protocol, &$links, $attr) {
if ($match[4]) {
$protocol = $match[4];
}
Expand Down

0 comments on commit e0f1067

Please sign in to comment.