Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2175
bug2845-head.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 8:41 PM
2014-11-21 20:41:23 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
bug2845-head.patch
View Options
Index: includes/RawPage.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/RawPage.php,v
retrieving revision 1.31
diff -u -4 -r1.31 RawPage.php
--- includes/RawPage.php 27 Jun 2005 03:48:05 -0000 1.31
+++ includes/RawPage.php 13 Jul 2005 19:43:58 -0000
@@ -19,10 +19,9 @@
*/
class RawPage {
function RawPage( $article ) {
- global $wgRequest, $wgInputEncoding, $wgSquidMaxage, $wgJsMimeType;
- $allowedCTypes = array('text/x-wiki', $wgJsMimeType, 'text/css', 'application/x-zope-edit');
+ global $wgRequest, $wgInputEncoding, $wgSquidMaxage, $wgJsMimeType, $wgRawMimetypeDefault, $wgRawMimetypeWhitelist;
$this->mArticle =& $article;
$this->mTitle =& $article->mTitle;
$ctype = $wgRequest->getText( 'ctype' );
@@ -33,24 +32,25 @@
$gen = $wgRequest->getText( 'gen' );
if($gen == 'css') {
$this->mGen = $gen;
if($smaxage == '') $smaxage = $wgSquidMaxage;
- if($ctype == '') $ctype = 'text/css';
+ $ctype = 'text/css';
} else if ($gen == 'js') {
$this->mGen = $gen;
if($smaxage == '') $smaxage = $wgSquidMaxage;
- if($ctype == '') $ctype = $wgJsMimeType;
+ $ctype = $wgJsMimeType;
} else {
$this->mGen = false;
+
+ if(empty($ctype) or !in_array($ctype, $wgRawMimetypeWhitelist)) {
+ $this->mContentType = $wgRawMimetypeDefault;
+ } else {
+ $this->mContentType = $ctype;
+ }
}
$this->mCharset = $wgInputEncoding;
$this->mSmaxage = $smaxage;
$this->mMaxage = $maxage;
- if(empty($ctype) or !in_array($ctype, $allowedCTypes)) {
- $this->mContentType = 'text/x-wiki';
- } else {
- $this->mContentType = $ctype;
- }
}
function view() {
global $wgUser, $wgOut, $wgScript;
Index: includes/DefaultSettings.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/DefaultSettings.php,v
retrieving revision 1.357
diff -u -4 -r1.357 DefaultSettings.php
--- includes/DefaultSettings.php 13 Jul 2005 01:05:21 -0000 1.357
+++ includes/DefaultSettings.php 13 Jul 2005 19:44:01 -0000
@@ -1582,5 +1582,18 @@
* Enable interwiki transcluding. Only when iw_trans=1.
*/
$wgEnableScaryTranscluding = false;
+/**
+ * The default mimetype for pages served with action=raw.
+ */
+$wgRawMimetypeDefault = 'text/x-wiki';
+
+/**
+ * Whitelist of allowed mimetypes for pages served with action=raw
+ */
+$wgRawMimetypeWhitelist = array('text/x-wiki',
+ 'text/css',
+ 'application/x-zope-edit',
+ 'text/plain');
+
?>
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1752
Default Alt Text
bug2845-head.patch (2 KB)
Attached To
Mode
T4845: Configurable whitelist for action=raw content types
Attached
Detach File
Event Timeline
Log In to Comment