From: Tim Düsterhus Date: Fri, 6 Aug 2021 13:37:58 +0000 (+0200) Subject: Use PSR-7 responses in UserExportGdprAction X-Git-Tag: 5.5.0_Alpha_1~493^2^2~14 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9eba6cb176274d0061b6237c3f551ac6a5761498;p=GitHub%2FWoltLab%2FWCF.git Use PSR-7 responses in UserExportGdprAction --- 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 + )); } /**