From 36eda874c374785647ab5fe2131c39926f5f3b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20Crespo?= Date: Fri, 15 May 2026 12:22:09 +0200 Subject: [PATCH] Fix REST API digital object downloads Return the digital object download marker from the action and stream the file contents directly. The previous code passed readfile() into setContent(), which mixed immediate output with Symfony response content handling and stored the byte count returned by readfile() as response content. Mark the Symfony response as header-only after readfile() so the final rendering filter does not send response content after the file body has already been emitted. --- .../informationobjectsDownloadDigitalObjectAction.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/arRestApiPlugin/modules/api/actions/informationobjectsDownloadDigitalObjectAction.class.php b/plugins/arRestApiPlugin/modules/api/actions/informationobjectsDownloadDigitalObjectAction.class.php index 49049a53b5..37f46ea331 100644 --- a/plugins/arRestApiPlugin/modules/api/actions/informationobjectsDownloadDigitalObjectAction.class.php +++ b/plugins/arRestApiPlugin/modules/api/actions/informationobjectsDownloadDigitalObjectAction.class.php @@ -66,7 +66,7 @@ protected function get($request) } } - $this->downloadDigitalObject($request); + return $this->downloadDigitalObject($request); } protected function downloadDigitalObject($request) @@ -97,8 +97,8 @@ protected function downloadDigitalObject($request) ob_end_clean(); } - $this->getResponse()->setContent(readfile($this->path)); - $this->getResponse()->sendContent(); + readfile($this->path); + $this->getResponse()->setHeaderOnly(true); return 'DigitalObject'; }