From 627038e2fad2082cf8ce5685787adbe188a05bd1 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Tue, 2 May 2017 22:03:38 +0200 Subject: [PATCH] [YoutubeBridge] Improve URL handling in video descriptions This improves the translation of regular text to anchors by adding support for additional characters '?&=-_' to fix common URLs. Notice: The regex pattern is by no means complete. That means it is likely to break in the future. More sophistiated solutions however are insanely complex. See: http://stackoverflow.com/a/190405 References #520 --- bridges/YoutubeBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/YoutubeBridge.php b/bridges/YoutubeBridge.php index 786530b7..117b84ad 100644 --- a/bridges/YoutubeBridge.php +++ b/bridges/YoutubeBridge.php @@ -78,7 +78,7 @@ class YoutubeBridge extends BridgeAbstract { // Make sure the description is easy on the eye :) $desc = htmlspecialchars($desc); $desc = nl2br($desc); - $desc = preg_replace('/(http[s]{0,1}\:\/\/[a-zA-Z0-9.\/]{4,})/ims', + $desc = preg_replace('/(http[s]{0,1}\:\/\/[a-zA-Z0-9.\/\?\&=\-_]{4,})/ims', '$1 ', $desc);