From 9eba6cb176274d0061b6237c3f551ac6a5761498 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 6 Aug 2021 15:37:58 +0200 Subject: [PATCH] Use PSR-7 responses in UserExportGdprAction --- .../acp/action/UserExportGdprAction.class.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/action/UserExportGdprAction.class.php b/wcfsetup/install/files/lib/acp/action/UserExportGdprAction.class.php index 568865fe1b..299a19cf7a 100644 --- a/wcfsetup/install/files/lib/acp/action/UserExportGdprAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/UserExportGdprAction.class.php @@ -2,6 +2,7 @@ namespace wcf\acp\action; +use Laminas\Diactoros\Response\JsonResponse; use wcf\action\AbstractAction; use wcf\data\package\PackageCache; use wcf\data\user\cover\photo\DefaultUserCoverPhoto; @@ -240,16 +241,16 @@ class UserExportGdprAction extends AbstractAction $this->data['@@generatedAt'] = TIME_NOW; - @\header('Content-type: application/json; charset=UTF-8'); - @\header('Content-disposition: attachment; filename="user-export-gdpr-' . $this->user->userID . '.json"'); - - HeaderUtil::sendNoCacheHeaders(); - - echo \json_encode($this->data, \JSON_PRETTY_PRINT); - $this->executed(); - exit; + return HeaderUtil::withNoCacheHeaders(new JsonResponse( + $this->data, + 200, + [ + 'content-disposition' => 'attachment; filename="user-export-gdpr-' . $this->user->userID . '.json"', + ], + JsonResponse::DEFAULT_JSON_FLAGS | \JSON_PRETTY_PRINT + )); } /** -- 2.20.1