Skip to content
Snippets Groups Projects

Issue #3392196: Exceptions in batch no longer are shown on the page

Open Issue #3392196: Exceptions in batch no longer are shown on the page
1 unresolved thread
Open Ted Bowman requested to merge issue/drupal-3392196:3392196-exceptions-in-batch into 11.x
1 unresolved thread
Files
8
@@ -12,7 +12,6 @@
use Drupal\Core\Site\Settings;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -304,14 +303,27 @@ protected function setExpiresNoCache(Response $response) {
*
* @param \Symfony\Component\HttpKernel\Event\ResponseEvent $event
* The event to process.
*
* @see \Symfony\Component\HttpFoundation\Response::prepare()
* @see https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length
*/
public function setContentLengthHeader(ResponseEvent $event): void {
$response = $event->getResponse();
if ($response instanceof StreamedResponse) {
if ($response->isInformational() || $response->isServerError() || $response->isEmpty()) {
return;
}
if ($response->headers->has('Transfer-Encoding')) {
return;
}
$content = $response->getContent();
if ($content === FALSE) {
return;
}
$response->headers->set('Content-Length', strlen($response->getContent()), TRUE);
$response->headers->set('Content-Length', strlen($content), TRUE);
}
/**
Loading