refactor: format rendering (#4229)

This commit is contained in:
Dag 2024-08-23 17:34:06 +02:00 committed by GitHub
parent c849576c93
commit 6516e31c1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 25 additions and 50 deletions

View file

@ -160,9 +160,15 @@ class DisplayAction implements ActionInterface
$format->setLastModified($now);
$headers = [
'last-modified' => gmdate('D, d M Y H:i:s ', $now) . 'GMT',
'content-type' => $format->getMimeType() . '; charset=' . $format->getCharset(),
'content-type' => $format->getMimeType() . '; charset=UTF-8',
];
return new Response($format->stringify(), 200, $headers);
$body = $format->render();
// This is supposed to remove non-utf8 byte sequences, but I'm unsure if it works
ini_set('mbstring.substitute_character', 'none');
$body = mb_convert_encoding($body, 'UTF-8', 'UTF-8');
return new Response($body, 200, $headers);
}
private function createFeedItemFromException($e, BridgeAbstract $bridge): array