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 3d50731 commit 76101bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Psr7PartialDownload.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ 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);
// normalize to prevent utf8 problems
if (class_exists('\Normalizer')) {
$fileName = preg_replace('/\p{Mn}/u', '', \Normalizer::normalize($fileName, \Normalizer::FORM_KD));
}

$response = $response->withHeader('Content-Type', $contentType);
Expand Down

0 comments on commit 76101bf

Please sign in to comment.