Page MenuHomePhabricator

Content-disposition: download insufficient to force download of Special:Export output; consider forcing Content-Type
Closed, InvalidPublic

Description

Regarding this section of includes/specials/SpecialExport.php,

header( "Content-type: application/xml; charset=utf-8" );
if( $wgRequest->getCheck( 'wpDownload' ) ) {

		// Provide a sane filename suggestion
		$filename = urlencode( $wgSitename . '-' . wfTimestampNow() . '.xml' );
		$wgRequest->response()->header( "Content-disposition: attachment;filename={$filename}" );

}

For me, I would expect two different responses in the users' browser:

  1. if the wpDownload box is checked, the browser would insist they

save the response in a file, and would not show them anything on the
screen.

  1. if the wpDownload box is NOT checked, the browser would show them

the same contents directly.

This all works fine if one uses Firefox, but in midori, emacs-w3m,
etc. browsers I tested here on Debian GNU/Linux, one just gets for 1
and 2 the same mishmosh of semi rendered mess.

Yes, this is all the fault of those browsers not being up to date with
the trends of today, but I still propose you instead make the
wpDownload choice a radio button with additional choices:

  • "send as text/plain, for guaranteed visibility in ones browser"
  • "send as application/download or application/octal-stream or

something, for guaranteed forcing the browser to save in a file"

Of course the default checked item should still be like 1) above.


Version: 1.13.x
Severity: enhancement

Details

Reference
bz16963

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:28 PM
bzimport set Reference to bz16963.
bzimport added a subscriber: Unknown Object (MLST).

P.S., on this page you might want to give a link to
http://www.mediawiki.org/wiki/API to alert the user to alternatives...

Updated summary to clarify issue.

The "save as file" feature appears to work correctly in modern browsers.

(In reply to Dan Jacobson from comment #0)

This all works fine if one uses Firefox, but in midori, emacs-w3m,
etc. browsers I tested here on Debian GNU/Linux, one just gets for 1
and 2 the same mishmosh of semi rendered mess.

According to [[mw:Compatibility#Browser]] we generally don't make an effort to make things work 100% smoothly on obscure browsers like midori and emacs-w3m. The workaround is simple (Ctrl+S or equivalent) so it's hardly a massive break of functionality in any case.

Closing this bug as overly general. If you have specific instances of this not working in listed browsers, please file new bugs for each.