Page MenuHomePhabricator

[Gadget-libUtil.js] mw.libs.commons.guessUser() returns full query string, not the user name only
Closed, InvalidPublic

Description

The function mw.libs.commons.guessUser() declared in https://commons.wikimedia.org/wiki/MediaWiki:Gadget-libUtil.js return incorrect result if called from the context of https://commons.wikimedia.org/w/index.php?title=Special:Contributions/Martin_wolf&offset=&limit=500&target=Martin+wolf

Returned result: "Martin_wolf&offset=&limit=500&target=Martin+wolf"
Expect result: "Martin_wolf"

This breaks the behavior of the default MyUploads gadget on Wikimedia Commons.

Event Timeline

Blahma raised the priority of this task from to Needs Triage.
Blahma updated the task description. (Show Details)
Blahma added projects: Commons, JavaScript.
Blahma subscribed.

I don't think that gadget is maintained here in Phabricator. You might want to just post on the talk page: https://commons.wikimedia.org/wiki/MediaWiki_talk:Gadget-libUtil.js

Generally, I would recommend using mw.config.get( 'wgRelevantUserName' ) instead of mw.libs.commons.guessUser().

Blahma claimed this task.

Thank you for your advice. It is sometimes difficult to figure out where to report what, particularly if it already takes a lot of work to find out first where in code a feature is located, which libraries it calls and whether all those scripts are either site specific, project specific, MediaWiki core or some extension (local or global). The associated talk page was last edited in 2013, which did not seem very welcoming, but I have now posted my report there in hope of somebody indeed coming across it. It seems that the bug has actually been fixed since a few days, but so far for a few other similar cases only. I have tried to share your suggestion regarding the called function in that page too, but that may well be useless there, as one would need to report that separately to the maintainer of the other extension which creates the actual "User Uploads" link.

Aklapper renamed this task from mw.libs.commons.guessUser() returns full query string, not the user name only to [Gadget-libUtil.js] mw.libs.commons.guessUser() returns full query string, not the user name only.Feb 7 2016, 11:24 PM
Aklapper changed the task status from Resolved to Invalid.
Aklapper removed Blahma as the assignee of this task.
Aklapper set Security to None.

<code>wgRelevantUserName</code> has been added to MediaWiki in 2013, while this script was written in 2012.

[[Special:CentralAuth]], [[Special:ListFiles]] and as the target on [[Special:Log]], there is no wgRelevantUserName. Sorry for the misguided bug report and thanks for reporting at Commons.