Use PSR-7 responses in AJAXUploadAction
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 10 Aug 2021 12:49:29 +0000 (14:49 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 11 Aug 2021 14:29:54 +0000 (16:29 +0200)
The IE 9 fallback technically should no longer be required, but the (legacy)
JavaScript still references the `isFallback` parameter.

wcfsetup/install/files/lib/action/AJAXUploadAction.class.php

index e20aace5117fce6ac8d5665f5d23b11399eeabdc..2216038552890a6d3422845bd99e036e6549c357 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace wcf\action;
 
+use Laminas\Diactoros\Response\JsonResponse;
 use wcf\system\upload\UploadHandler;
 use wcf\util\JSON;
 
@@ -34,10 +35,10 @@ class AJAXUploadAction extends AJAXProxyAction
             parent::sendResponse();
         }
 
+        $response = new JsonResponse($this->response);
         // IE9 is mad if iframe response is application/json
-        \header('Content-type: text/plain');
-        echo JSON::encode($this->response);
+        $response = $response->withHeader('content-type', 'text/plain');
 
-        exit;
+        return $response;
     }
 }