Skip to content

Commit 76101bf

Browse files
committed
IE content-disposition bugfix
1 parent 3d50731 commit 76101bf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Psr7PartialDownload.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ 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);
32+
// normalize to prevent utf8 problems
33+
if (class_exists('\Normalizer')) {
34+
$fileName = preg_replace('/\p{Mn}/u', '', \Normalizer::normalize($fileName, \Normalizer::FORM_KD));
3435
}
3536

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

0 commit comments

Comments
 (0)