From: Jack D. Pond Date: Fri, 4 Sep 2009 03:44:14 +0000 (+0000) Subject: Bug 20489 Configure illegal file characters https://bugzilla.wikimedia.org/show_bug... X-Git-Tag: 1.31.0-rc.0~39941 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=ad54e0bcf8ab6b20111aab9889c6dd2cfe5d7111;p=lhc%2Fweb%2Fwiklou.git Bug 20489 Configure illegal file characters https://bugzilla.wikimedia.org/show_bug.cgi?id=20489 $wgIllegalFileChars configurable to add chars for filename automatically converted to "-". --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index a696564221..d0b806f63d 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -288,6 +288,7 @@ $wgForeignFileRepos = array(); * this breaks interlanguage links */ $wgLegalTitleChars = " %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+"; +$wgIllegalFileChars = ":"; // These are additional characters that should be replaced with '-' in file names /** * The external URL protocols diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index e1eb6abd85..4cbed9e5a7 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -3228,8 +3228,9 @@ function wfGenerateToken( $salt = '' ) { * @param $name Mixed: filename to process */ function wfStripIllegalFilenameChars( $name ) { + global $wgIllegalFileChars; $name = wfBaseName( $name ); - $name = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $name ); + $name = preg_replace("/[^".Title::legalChars()."]".($wgIllegalFileChars ? "|[".$wgIllegalFileChars."]":"")."/",'-',$name); return $name; }