Skip to content

Commit

Permalink
TASK: Simplify module controller request handling
Browse files Browse the repository at this point in the history
and incorporate fix neos#5179 for Neos 9
  • Loading branch information
mhsdesign committed Sep 12, 2024
1 parent 9bd0352 commit a158b25
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Neos.Neos/Classes/Controller/Backend/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,15 @@ public function indexAction(array $module)

if ($moduleResponse->hasHeader('Location')) {
// Preserve redirects see b57d72aeeaa2e6da4d9c0a80363025fefd63d813
// todo just return $moduleResponse and not merge with $this->response?
$this->redirectToUri($moduleResponse->getHeaderLine('Location'), 0, $moduleResponse->getStatusCode());
return $moduleResponse;
} elseif ($moduleRequest->getFormat() !== 'html') {
// Allow ajax request with json or similar dd7e5c99924bf1b8618775bec08cc4f2cb1a6d2a
// todo just return $moduleResponse and not merge with $this->response?
// todo just return $moduleResponse and trust its content-type instead of inferring the requested content-type
$mediaType = MediaTypes::getMediaTypeFromFilename('file.' . $moduleRequest->getFormat());
if ($mediaType !== 'application/octet-stream') {
$this->response->setContentType($mediaType);
$moduleResponse = $moduleResponse->withHeader('Content-Type', $mediaType);
}
return $moduleResponse->getBody();
return $moduleResponse;
} else {
/** @var ?Account $authenticatedAccount */
$authenticatedAccount = $this->securityContext->getAccount();
Expand Down

0 comments on commit a158b25

Please sign in to comment.