Last modified: 2009-11-28 04:43:47 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T22489, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 20489 - Configure illegal file characters
Configure illegal file characters
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.16.x
All All
: Normal normal (vote)
: ---
Assigned To: Chad H.
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-03 16:05 UTC by Jack D. Pond
Modified: 2009-11-28 04:43 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Configurable Illegal Chars in File names (1.03 KB, patch)
2009-09-03 16:05 UTC, Jack D. Pond
Details

Description Jack D. Pond 2009-09-03 16:05:55 UTC
Created attachment 6524 [details]
Configurable Illegal Chars in File names

Sometime between 1.11 and 1.13, the function wfStripIllegalFilenameChars in Global.php was modified to change all occurances of ':' to '-' by adding the '|:' to the preg_replace.

This addition effectively disables the ability to use categories or namespaces as part of the file definition.  One specific case is the use of namespace for restricting access to images/files:

[[File:Project:ProjectPlan.txt]]

Additionally, since it is hardcoded, it does not allow certain platforms to further restrict characters in the file names, for example, while backtick "`" is certainly allowable, on certain platforms if used in a filename will cause issues.

Furthermore, these types of things are generally configurable in MediaWiki for example:

$wgLegalTitleChars = " %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+";

Which is used in Title::legalChars() as

	public static function legalChars() {
		global $wgLegalTitleChars;
		return $wgLegalTitleChars;
	}

The proposed change is to make illegal file characters a configuration variable, defaulting to the current ":", e.g.

$wgIllegalFileChars = ":";  // These are additional characters that should be replaced with '-' in file names

The change is simple, straightforward, and would have minimal performance impact - see attachments.  It's value would be to allow both cross-platform capabilities and FileRepo configurability, as well as enable [[Extension:NSFileRepo]] without requiring patches.
Comment 1 Raimond Spekking 2009-09-04 20:51:00 UTC
Patch applied with r55802 by jdpond.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links