Skip to content

Commit

Permalink
IE content-disposition bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
rauwebieten committed Sep 13, 2017
1 parent 490194f commit 3d50731
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Psr7PartialDownload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"");
Expand Down

0 comments on commit 3d50731

Please sign in to comment.