Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2174
bug2845.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
3 KB
Referenced Files
None
Subscribers
None
bug2845.patch
View Options
Index: includes/RawPage.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/RawPage.php,v
retrieving revision 1.22.2.5
diff -u -6 -p -d -r1.22.2.5 RawPage.php
--- includes/RawPage.php 10 Jan 2005 22:53:00 -0000 1.22.2.5
+++ includes/RawPage.php 13 Jul 2005 17:13:13 -0000
@@ -14,14 +14,13 @@
* @todo document
* @package MediaWiki
*/
class RawPage {
function RawPage( $article ) {
- global $wgRequest, $wgInputEncoding, $wgSquidMaxage;
- $allowedCTypes = array('text/x-wiki', 'text/javascript', 'text/css', 'application/x-zope-edit');
+ global $wgRequest, $wgInputEncoding, $wgSquidMaxage, $wgRawMimetypeDefault, $wgRawMimetypeWhitelist;
$this->mArticle =& $article;
$this->mTitle =& $article->mTitle;
$ctype = $wgRequest->getText( 'ctype' );
# getInt eats the zero, breaks caching
$smaxage= $wgRequest->getText( 'smaxage' ) == '0' ? 0 :
@@ -31,28 +30,29 @@ class RawPage {
$this->mOldId = $wgRequest->getInt( 'oldid' );
# special case for 'generated' raw things: user css/js
$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 = 'text/javascript';
+ $ctype = 'text/javascript';
} 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;
/* XXX: breaks toplevel wikis */
Index: includes/DefaultSettings.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/DefaultSettings.php,v
retrieving revision 1.215.2.60
diff -u -6 -p -d -r1.215.2.60 DefaultSettings.php
--- includes/DefaultSettings.php 7 Jul 2005 07:05:49 -0000 1.215.2.60
+++ includes/DefaultSettings.php 13 Jul 2005 17:13:14 -0000
@@ -1086,12 +1086,25 @@ $wgCountCategorizedImagesAsUsed = false;
* $wgExternalStores = array("http","file","custom")...
*
* CAUTION: Access to database might lead to code execution
*/
$wgExternalStores = 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');
+
} else {
die("MEDIAWIKI not defined, this is not a valid entry point\n");
}
?>
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1751
Default Alt Text
bug2845.patch (3 KB)
Attached To
Mode
T4845: Configurable whitelist for action=raw content types
Attached
Detach File
Event Timeline
Log In to Comment