[VkBridge] Better title generation (#3563)

1. Use first parargraph only
2. Remove tags
3. Allow to use comma and colon in title
This commit is contained in:
Eugene Molotov 2023-07-22 17:00:12 +05:00 committed by GitHub
parent 39a8346c53
commit 38ca124de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -448,7 +448,9 @@ class VkBridge extends BridgeAbstract
private function getTitle($content)
{
preg_match('/^["\w\ \p{L}\(\)\?#«»-]+/mu', htmlspecialchars_decode($content), $result);
$content = explode('<br>', $content)[0];
$content = strip_tags($content);
preg_match('/^[:,"\w\ \p{L}\(\)\?#«»-]+/mu', htmlspecialchars_decode($content), $result);
if (count($result) == 0) {
return 'untitled';
}