Page MenuHomePhabricator

File Extension check on Move page but not on upload new version.
Open, Needs TriagePublic

Description

If I upload a file
"myDocument.doc"
then "Upload a new version of this file"
"myDocument.pdf"
then try to move File:myDocument.doc to File:myDocument.pdf
I get the error
"You do not have permission to move this page, for the following reason:
The new file extension does not match its type."

isValidFileMove() in Move.php is calling
File::checkExtensionCompatibility and failing

Either this check should be removed so I can rename the File or a similar check should be performed on upload so I am unable to upload a new version of a file with an incompatible file extension. (Personally, I'd like the check to be removed so I have the flexibility to change file extensions of files in the system and allow redirects to point to renamed files)

Event Timeline

From my understanding, not all file types are supported. That means you want to have the flexibility to change file extension on the system even to non-supported file types?

I'm happy to restrict to the types in the $wgFileExtensions array. More specifically if the system allows me to upload a file with a different extension to the one currently there I'd like to be able to rename the file to the new extension.