From 3d50731886d157e36993251ab40bfe5fb81edc66 Mon Sep 17 00:00:00 2001 From: rauwebieten Date: Wed, 13 Sep 2017 15:55:41 +0200 Subject: [PATCH] IE content-disposition bugfix --- src/Psr7PartialDownload.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Psr7PartialDownload.php b/src/Psr7PartialDownload.php index 778e8d7..0321711 100644 --- a/src/Psr7PartialDownload.php +++ b/src/Psr7PartialDownload.php @@ -29,6 +29,10 @@ public function sendFile(ServerRequestInterface $request, ResponseInterface $res $invalidChars = array('<', '>', '?', '"', ':', '|', '\\', '/', '*', '&'); $fileName = str_replace($invalidChars, '', $fileName); + if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) { + $fileName = rawurlencode($fileName); + } + $response = $response->withHeader('Content-Type', $contentType); $response = $response->withHeader('Accept-Ranges', 'bytes'); $response = $response->withHeader('Content-Disposition', "attachment; filename=\"{$fileName}\"");