瀏覽代碼

[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
logmanoriginal 7 年之前
父節點
當前提交
627038e2fa
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      bridges/YoutubeBridge.php

+ 1 - 1
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',
 				'<a href="$1" target="_blank">$1</a> ',
 				$desc);