Page MenuHomePhabricator

File extension changes automatically while moving ogg audio file on Commons, caused by a gadget
Open, LowPublic

Description

[Original title: "Change the file extension of a file to the most commonly used extension in the time of uploading (like .JPG to .jpg for images, .ogg to .oga for audios, .ogg to ogv for videos)"]

See my comment on https://commons.wikimedia.org/wiki/Commons:Help_desk#File_format_changes_automatically_while_moving_Audio_Files (https://commons.wikimedia.org/w/index.php?title=Commons:Help_desk&oldid=205417112#File_format_changes_automatically_while_moving_Audio_Files, permalink):

If file extensions (not format) changes while they are moved, then they should have changed on the time of uploading. This change of file extensions create some problems, like group of files not in harmony (which is caused by one or more files having different file extensions), forcing a filemover to move a lot of files in the group to be in harmony instead of moving just few. I will be filing a task in Phabricator about this. ★ Poké95 12:31, 2 September 2016 (UTC)


See Also:
T34660: File extensions for the same file type should not allow variations of a file name (File:X.jpg, File:X.jpeg, File:X.JPG should all refer to the same file)
T31284: Upload form should change file extensions to the canonical form automatically (lowercase, jpeg→jpg etc.)
T213484: Normalize file extensions (capital vs small letters; jpg vs jpeg) for new uploads on Commons
T42479: File extensions should be automatically decided by MIME type at upload

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Maybe those files were uploaded before this "autorename" was introduced. Are you sure this autorename isn't happening now at upload time?

Ciencia_Al_Poder: Here is a link to a .ogg file that was uploaded yesterday:

https://commons.wikimedia.org/wiki/File:Pa-%E0%A8%89%E0%A8%82%E0%A8%97%E0%A8%B2.ogg

Its extension did not change at the time of uploading.

File extensions are normalized when uploading with UploadWizard, but not when using other tools. Some of the rules are different than what you propose (e.g. we normalize .ogv to .ogg): https://github.com/wikimedia/mediawiki/blob/f7d75435afe6589ee4b05f02259def121d633954/resources/src/mediawiki/mediawiki.Title.js#L767. That was implemented per T36703. There are old tasks about doing this everywhere, e.g. T34660, T31284. It's not trivial, if only because we already have probably millions of files with names that would become incorrect if this was done. This would likely be a duplicate of one of those tasks.

But I'd like to go back to the original issue – "File format changes automatically while moving Audio Files". I am pretty sure that MediaWiki does not do this. This has to be caused by some Commons-specific customization; I don't see immediately what would do this. I guess I'll need to get filemover rights and see for myself.

Fair enough.

I didn't know about this change on renaming files, but I'm unable to reproduce it. on my local MediaWiki install downloaded from git. I've downloaded that file, uploaded it, and renamed, and it still has the .ogg extension.

Automatically changing the file extension when a file is moved, without issuing a warning to the user, is a very bad decision IMHO.

I'm pretty sure this happens in the confusingly-named https://commons.wikimedia.org/wiki/MediaWiki:Gadget-AjaxQuickDelete.js, in the cleanFileName method. It replaces the file's extension with mimeFileExtension, calculated earlier from the MIME type of the file.

matmarex renamed this task from Change the file extension of a file to the most commonly used extension in the time of uploading (like .JPG to .jpg for images, .ogg to .oga for audios, .ogg to ogv for videos) to File format changes automatically while moving Audio Files (on Commons, caused by a gadget?).Sep 6 2016, 6:05 PM
matmarex edited projects, added WMF-General-or-Unknown; removed MediaWiki-Uploading.
matmarex updated the task description. (Show Details)

This task would be a duplicate of T31284 as originally filed and I think the real issue is elsewhere, so I changed the task title to be about that.

zhuyifei1999 renamed this task from File format changes automatically while moving Audio Files (on Commons, caused by a gadget?) to File extension changes automatically while moving ogg audio file on Commons, caused by a gadget.Jul 25 2017, 12:07 PM