Page MenuHomePhabricator

Upgrade from MW 1.39 to 1.45 breaks image file links due to auto-capitalization of File: page names
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

Migrating from a computer running MediaWiki 1.39.3 to another computer running MediaWiki 1.45.1

ON THE TARGET SERVER, destroy the existing database:
sudo mysqladmin -u root -pndist drop wikidb
Create a new database:
sudo mysqladmin -u root -pndist create wikidb
Import the data to the new database:
sudo mysql -u root -pndist wikidb < /mnt/z/temp/dump_of_wikidb.sql

Run the update script:
php /var/www/html/wiki/maintenance/update.php

Copy Images from the old server
First, make sure I am a member of the www-data group.
sudo usermod -a -G www-data steve
ON THE SOURCE SERVER, Copy all of the wiki files:
mkdir /mnt/z/wiki
sudo cp -r /var/www/html/mediawiki/* /mnt/z/wiki

ON THE TARGET SERVER,
Delete the new images folder. The CP command will create a new one.
sudo rm -r /var/www/html/wiki/images
Copy the images from the backup to the new server images folder:
sudo cp -R /mnt/z/wiki/images /var/www/html/wiki
Because we used sudo to copy the images, they are owned by root. So change the owner:group of all of the images:
sudo chown -R www-data:www-data /var/www/html/wiki/images

What happens?:

This at first seemed pretty straightforward and the brief scan of a few pages looked good. Except... The older version allowed image uploads whose filenames began with lowercase letters. The newer version silently forces the first letter of all filenames in the File: namespace to uppercase.

This behavior caused hundreds of image links to break during the migration.

What should have happened instead?:

Grandfather older file naming or add an option to not force capitalization of file uploads. Similar to $wgCapitalLinkOverrides[NS_MAIN] = false;

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
MediaWiki 1.45.1

Other information (browser name/version, screenshots, etc.):

When the first letter is forced to uppercase, MediaWiki no longer recognizes the original lowercase filenames, even though the files physically exist in the images/ directory.

The result is:

Hundreds of broken image links
Many images that appear “missing” even though the files are present
No built‑in tool to detect or repair these mismatches
A migration process that becomes extremely time‑consuming and error‑prone

At this point, it will take me weeks to manually locate, repair, or reconstruct all the broken image references.

Event Timeline

Aklapper renamed this task from Migration to latest Mediawiki broke hundreds of image file links. to Upgrade from MW 1.39 to 1.45 breaks image file links due to auto-capitalization of File: page names.Sat, Jan 24, 10:26 PM