Merge pull request #176 from shikorism/fix/174-ap-empty-content

ActivityPubResolverでcontentが空のときはHTMLとしてのパースを行わないようにする
This commit is contained in:
shibafu 2019-04-17 23:38:52 +09:00 committed by GitHub
commit b3ea665f0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,6 +73,10 @@ class ActivityPubResolver implements Resolver, Parser
private function html2text(string $html): string
{
if (empty($html)) {
return '';
}
$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
$html = preg_replace('~<br\s*/?\s*>|</p>\s*<p[^>]*>~i', "\n", $html);
$dom = new \DOMDocument();