Matthew Campbell
Matthew Campbell

Reputation: 1884

MediaWiki upgrade breaks File prefix but legacy Image works

Did a MediaWiki upgrade from 1.15.1 to 1.20.2 by following the simple update instructions (basically a new installation, copying over the old LocalSettings.php, update script and copying over images). Weird thing now is that all of the File: prefixes don't work. Instead the internal links to images is a "file:name of image" URL rather than "http://mediawiki address/index.php/File:name of image".

Anybody else getting this. Assuming it is something wrong with the old LocalSettings.php.

Ran the refreshLinks and refreshImageMetadata maintenance scripts without fixing the problem.

Upvotes: 2

Views: 218

Answers (1)

Ilmari Karonen
Ilmari Karonen

Reputation: 50328

In the comments, you wrote that you have file: added to $wgUrlProtocols. This is very likely what's triggering the problem.

It looks like something has changed in the parser between MW 1.15 and 1.20 so that it's now parsing file:whatever as an external link (since it matches the file: prefix you've defined in $wgUrlProtocols) even if it's inside square brackets.

The obvious workaround would be to change the $wgUrlProtocols entry from file: to file:// so that it will only match if the slashes are there (as they should be, according to standard file: URL syntax). Since your on-wiki filenames are, presumably, very unlikely to begin with double slashes, they should not match this more specific prefix.

That said, this could still be considered a bug in MediaWiki. You may want to file a bug report about it, if there isn't one yet. (Edit: Looks like Mark A. Hershberger filed one already.)

Upvotes: 2

Related Questions