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