Skip to content
Snippets Groups Projects
Commit 4f7569d9 authored by JediKev's avatar JediKev
Browse files

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.
parent a27a2975
No related branches found
No related tags found
No related merge requests found
...@@ -465,7 +465,7 @@ class Format { ...@@ -465,7 +465,7 @@ class Format {
function($match) { function($match) {
// Scan for things that look like URLs // Scan for things that look like URLs
return preg_replace_callback( 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})`', .'|(\b[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,63})`',
function ($match) { function ($match) {
if ($match[1]) { if ($match[1]) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment