Author: brianna.laugher
Description:
Hi,
A user at Commons reported getting an inappropriate warning:
When I do a trial upload of one image, I get an error "a file with a similar name already exists, choose another filename". Unfortunately the file that already exists is "drosera.jpg" (not my picture) and that blocks my "drosera.spatulata.flower.x16.jpg" and it will block all other Drosera images too.
I believe this is [[MediaWiki:fileexists-extension]] was introduced in r25481.
I believe it is caused because of this previous line in SpecialUpload.php:
list( $partname, $rawExtension ) = explode( '.', $file->getName(), 2 );
So in this case I think we have $partname = 'drosera', $rawExtension = 'spatulata'.
f ( $rawExtension != $file->getExtension() ) {
474 $nt_lc = Title::newFromText( $partname . '.' . strtolower( $ext ) ); We're not using the normalized form of the extension.
475 Normal form is lowercase, using most common of alternate
476 extensions (eg 'jpg' rather than 'JPEG').
477
478 // Check for another file using the normalized form...
479 $nt_lc = Title::newFromText( $partname . '.' . $file->getExtension() );
then since 'spatulata' != 'jpg', the new title ends up being 'drosera.jpg'. Hence the inappropriate error.
If '.' was not allowed in image titles that would work fine.
To fix it I suppose you could either do a regex string split thing, or else, do the explode and then join all but the last one back up again to form $partname.
Version: unspecified
Severity: minor