Skip to content

Commit

Permalink
Make sure we don't cache server errors
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Jan 4, 2025
1 parent a2ae32d commit b22f9f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/midcom/response/styled.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ class midcom_response_styled extends Response

public function __construct(midcom_core_context $context, string $root_element = 'ROOT')
{
parent::__construct();
$this->set_context($context);
$this->root_element = $root_element;
$this->content = $this->render();
parent::__construct($this->render());
}

private function render() : string
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/services/cache/module/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function on_response(ResponseEvent $event)
return;
}
$response = $event->getResponse();
if ($response instanceof BinaryFileResponse) {
if ($response instanceof BinaryFileResponse || $response->isServerError()) {
return;
}
foreach ($this->_sent_headers as $header => $value) {
Expand Down

0 comments on commit b22f9f4

Please sign in to comment.