mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
Remove bookmark prefix from naked URLs
See discussion here: https://hubzilla.org/channel/adminsforum?mid=00a360a1-6281-52aa-b4de-65493b8899f5
This commit is contained in:
@@ -277,13 +277,10 @@ function red_zrl_callback($matches) {
|
||||
$matches[2] = $t;
|
||||
}
|
||||
|
||||
if($matches[1] === '#^')
|
||||
$matches[1] = '';
|
||||
|
||||
if($zrl)
|
||||
return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]' . $pts[0];
|
||||
return $matches[1] . '[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]' . $pts[0];
|
||||
|
||||
return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]' . $pts[0];
|
||||
return $matches[1] . '[url=' . $matches[2] . ']' . $matches[2] . '[/url]' . $pts[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,9 +19,13 @@ class CleanupBBCodeTest extends UnitTestCase {
|
||||
public static function cleanup_bbcode_provider(): array {
|
||||
return [
|
||||
'url followed by newline' => [
|
||||
"#^[url=https://example.com]https://example.com[/url]\na test link",
|
||||
"[url=https://example.com]https://example.com[/url]\na test link",
|
||||
"https://example.com\na test link",
|
||||
]
|
||||
],
|
||||
'bookmarked url' => [
|
||||
"#^[url=https://example.com]https://example.com[/url] a test link",
|
||||
"#^https://example.com a test link",
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user