URL-encode the content-disposition suggested filename for XML export data.
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 17 Jul 2007 18:14:36 +0000 (18:14 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 17 Jul 2007 18:14:36 +0000 (18:14 +0000)
This fixes the filename encoding for non-pure-ASCII site names on IE 6/7, and may fix issues with other ASCIIish chars.
Safari 2/Mac messes up the filename either way, but percent codes are probably still better here than garbage characters. :)
IE/Mac and Safari 3/Win don't appear to pay attention to the content-disposition and still show the XML inline.

includes/SpecialExport.php

index 9822efa..12bd4d5 100644 (file)
@@ -133,7 +133,7 @@ function wfSpecialExport( $page = '' ) {
                header( "Content-type: application/xml; charset=utf-8" );
                if( $wgRequest->getCheck( 'wpDownload' ) ) {
                        // Provide a sane filename suggestion
-                       $filename = $wgSitename . '-' . wfTimestampNow() . '.xml';
+                       $filename = urlencode( $wgSitename . '-' . wfTimestampNow() . '.xml' );
                        $wgRequest->response()->header( "Content-disposition: attachment;filename={$filename}" );
                }
                $pages = explode( "\n", $page );