Page MenuHomePhabricator

Special:ListFiles shows usernames with underscores
Closed, ResolvedPublic


My username includes a space but an underscore is shown.

The page title is set in SpecialListFiles::execute in mediawiki/core repository.
The variable $userName should probably be sanitized by User::getCanonicalName.

Event Timeline

I would like to work on this task.

@matej_suchanek Thanks for the reference. Once I set up the environment, I'll start working.

Change 571681 had a related patch set uploaded (by Sahajsk; owner: Sahajsk):
[mediawiki/core@master] Fix::Special:ListFiles shows usernames with underscores

@matej_suchanek Can you help me with the cases when getCanonicalName return false? Also does the initial code handle the case of invalid username.


@thiemowmde pointed out User::getCanonicalName does validation by default. We can avoid validation by setting the second argument to false.

$userName = User::getCanonicalName( $temp_userName , false );
I have changed the statement to something like this.
Also should the condition to check if getCanonicalName returns false be removed or kept.

Thanks for the update. Unfortunately I can not see it yet on the patch

The check for false needs to stay, because there is still a chance it can return false, even without full validation.

Change 571681 merged by jenkins-bot:
[mediawiki/core@master] Make Special:ListFiles not show usernames with underscores