Skip to content

Commit 3d50731

Browse files
committed
IE content-disposition bugfix
1 parent 490194f commit 3d50731

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Psr7PartialDownload.php

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public function sendFile(ServerRequestInterface $request, ResponseInterface $res
2929
$invalidChars = array('<', '>', '?', '"', ':', '|', '\\', '/', '*', '&');
3030
$fileName = str_replace($invalidChars, '', $fileName);
3131

32+
if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) {
33+
$fileName = rawurlencode($fileName);
34+
}
35+
3236
$response = $response->withHeader('Content-Type', $contentType);
3337
$response = $response->withHeader('Accept-Ranges', 'bytes');
3438
$response = $response->withHeader('Content-Disposition', "attachment; filename=\"{$fileName}\"");

0 commit comments

Comments
 (0)