Skip to content

Commit ea12427

Browse files
committed
1 parent 6a43bc2 commit ea12427

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

system/Helpers/url_helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ function safe_mailto(string $email, string $title = '', $attributes = ''): strin
351351
function auto_link(string $str, string $type = 'both', bool $popup = false): string
352352
{
353353
// Find and replace any URLs.
354-
if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
354+
if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[a-z0-9]+(-+[a-z0-9]+)*(\.[a-z0-9]+(-+[a-z0-9]+)*)+(/([^\s()<>;]+\w)?/?)?#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
355355
// Set our target HTML if using popup links.
356356
$target = ($popup) ? ' target="_blank"' : '';
357357

0 commit comments

Comments
 (0)