From: Daniel Kinzler Date: Thu, 29 Mar 2012 13:13:23 +0000 (+0000) Subject: trigger http error when non-text content is requested using action=raw X-Git-Tag: 1.31.0-rc.0~22097^2^2~271 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=79f79a356ca764d3ccfdce63c849542975dfd071;p=lhc%2Fweb%2Fwiklou.git trigger http error when non-text content is requested using action=raw --- diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index 2dcc3875a3..1cac44ca5b 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -132,11 +132,20 @@ class RawAction extends FormlessAction { $request->response()->header( "Last-modified: $lastmod" ); // Public-only due to cache headers - $text = $rev->getText(); + $content = $rev->getContent(); + + if ( !$content instanceof TextContent ) { + wfHttpError( 406, "Not Acceptable", "The requeste page uses the content model `" + . $content->getModelName() . "` which is not supported via this interface." ); + die(); + } + $section = $request->getIntOrNull( 'section' ); if ( $section !== null ) { - $text = $wgParser->getSection( $text, $section ); + $content = $content->getSection( $section ); } + + $text = $content->getNativeData(); } }