Page MenuHomePhabricator

Rename treats different file names as same
Closed, DeclinedPublicFeature

Description

Feature summary (what you would like to be able to do and where):
Renaming should NOT treat file extensions as equal to each other. As in, when trying to rename, you can rename an .oga file to an .ogg file, and a .tif file to a .tiff file.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
When trying to rename this file to Concert for you.ogg, the renamer accidentally renamed it to Concert for you.oga. The problem is, while renaming treats .oga as better than .ogg, meaning you can’t rerename it, the Mediawiki system doesn’t, meaning that they are treated as two separate files.

Benefits (why should this be implemented?):
This is useful when the file extension itself is important to maintain a set (EXAMPLE1.JPG, EXAMPLE2.JPG, EXAMPLE3.jpg), or when the file extension is important to the name itself (Plain.tiff vs Plain.tif).

Event Timeline

Pppery subscribed.

The current behavior is correct as a technical matter. Both .ogg and .oga are valid extensions for OGG files:

https://github.com/wikimedia/mediawiki/blob/165602686b09dec866b40ed7c4a0b553bdb76435/includes/libs/Mime/MimeMap.php#L18

		'application/ogg' => [ 'ogx', 'ogg', 'ogm', 'ogv', 'oga', 'spx', 'opus' ],

Likewise both .tiff and .tif are valid extensions for tif files:

https://github.com/wikimedia/mediawiki/blob/165602686b09dec866b40ed7c4a0b553bdb76435/includes/libs/Mime/MimeMap.php#L55

		'image/tiff' => [ 'tiff', 'tif' ],

Hence, MediaWiki will let you create an ogg file at any one of those extensions, and arbitrarily move ogg files between those extensions - you could create a file as foo.ogg, move it to foo.oga, move it again to foo.ogv, and then finally move it back to foo.ogg. Likewise you can move TIFF files between .tif and .tiff as many times as you want.

I can't reproduce the behavior that "The problem is, while renaming treats .oga as better than .ogg, meaning you can’t rerename it". Maybe some human refused to push the button to do so, or they couldn't because of the presence of an existing redirect, but I see no code enforcing that ratchet logic you are reporting and it doesn't make sense.

MediaWiki shouldn't include the rule that the extension the original uploader chooses to use is unchallengable gospel; that takes away flexibility from users for no additional value. If the Commons community wants such a rule, or alternately wants to declare .oga better than .ogg, that's their right but there's no Phabricator bug here.