File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -667,7 +667,13 @@ private function get_nice_filename($headers) {
667
667
668
668
if (!empty ($ originalfilename )) {
669
669
$ result ['Content-Disposition ' ] = $ contentdisposition ;
670
- $ result ['filename ' ] = 'filename=" ' . utf8_encode ($ originalfilename ) . '" ' ;
670
+ // The filename parameter must be in ISO-8859-1, however it works in browsers if
671
+ // you treat the original UTF-8 string as ISO-8859-1 characters. To achieve that
672
+ // here, we encode the UTF-8 as if it were ISO-8859-1. This behaviour is hideous
673
+ // so it would be nice to use the optional filename* field (RFC 5987) but S3 still
674
+ // complains if we do that.
675
+ $ jankyfilename = \core_text::convert ($ originalfilename , 'ISO-8859-1 ' );
676
+ $ result ['filename ' ] = 'filename=" ' . $ jankyfilename . '" ' ;
671
677
$ result ['Content-Type ' ] = $ originalcontenttype ;
672
678
}
673
679
}
You can’t perform that action at this time.
0 commit comments