Page MenuHomePhabricator

JavaScript still tries to capitalise the first letter
Closed, ResolvedPublic


Author: Volodya

Even though i have explicitly set the wiki to '''not''' force the first letter to be capital, when i select the file for the upload the JavaScript on that page changes Destination filename to have the first letter capital. This is confusing and goes against the rules which i (as an administrator) set.

Version: 1.13.x
Severity: trivial



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:20 PM
bzimport set Reference to bz15470.

I'll take this. Shouldn't need to force capitalize (as Title cleans it up later before adding it to the database anyway...), but I'd like to double check.

For reference: line 135 of upload.js as of r40429.

When setting $wgCapitalLinks to true and removing the offending uppercase-always JS, it works as expected. However, with this removed, attempting to upload a lower-cased file on a $wgCapitalLinks-enabled wiki (ie: standard practice) generates an error that the title must be capitalized. While this is easily fixable (and in fact can be done automatically), I don't like seeing the extra un-needed step (where previously it was transparent, the box capitalized it _for_ you).

To get around this, wgCapitalLinks might be worth adding to the list of global JS variables we provide, so Javascripts can more accurately work with capitalizing the first-letter as needed. Thoughts?

Done as part of a general cleanup in r45689

Partial revert in r45745: This made the auto-filled destination file name no longer match what we would actually upload as. It would be better to make it *more* accurate (handling normalization of forbidden chars) rather than less accurate.
The particular problem of bug 15470 should be resolved by actually checking how normalization should proceed, not by failing to do it.

The attempt to avoid the warning for auto-capitalization is now actually working in r45744.

First letter in the destination filename field is still capped with $wgCapitalLinks = false;

admin wrote:

Hi, is there someone currently working on that bug ? In MW 1.15, I still have that problem, and it's important for me to keep the case lower for the first letter of the filename when the uploader upload a lowercase file. Setting $wgCapitalLinks = false; does not stop the files from being capitalized.

Bryan.TongMinh wrote:

I would personally prefer to have the normalization done server side. We are doing a request anyway to check existence, so trying to embed the normalization in that should not be a problem.

make capitalization in upload.js conditional on $wgCapitalLinks

This patch doesn't change anything server-side, only makes upload.js not do the capitalization when it's not called for.


Fixed in r70669. I didn't use the patch from this bug because we now have a per-namespace capitalization settings.