Page MenuHomePhabricator

Search bar on subpages leading to wrong result
Closed, InvalidPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

When you search you are taken to an article on the main domain with the same username as yours. In my case, my user is "!Silent" and I was taken to the address https://pt.wikipedia.org/w/index.php?search=Teste&title=%21Silent&go=Ir

What should have happened instead?:
It should work like search in any other location. Including on the page Wikipédia:Administradores/Pedidos de aprovação this problem not occurs.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
See https://pt.wikipedia.org/w/index.php?title=Wikip%C3%A9dia:Caf%C3%A9_dos_programadores&oldid=70013045#Erro_na_barra_de_pesquisa

Event Timeline

I think this is due to the <input type="hidden" name="title" value="Username"> right after the button.

Due to this part of your code: https://github.com/Nevallem/mw-gadget-requestForAdminship/blob/main/src/core.js#L429.

By input[name="title"], you probably meant to select one of the two fields at https://pt.wikipedia.org/wiki/Wikip%C3%A9dia:Administradores/Pedidos_de_aprova%C3%A7%C3%A3o. But there are also hidden inputs that the search button uses.

So get a better, more specific selector.

Also keep in mind: selecting elements with [prop=abc] is a bad idea, precisely due to risks like this. Use a class, or better yet, an ID, that's sure to not be ambiguous.

Cannot reproduce, I end up on https://pt.wikipedia.org/wiki/Teste thus likely an issue with custom code not tracked in Phabricator.
Please see https://www.mediawiki.org/wiki/Help:Locating_broken_scripts and test with safemode.

I think this is due to the <input type="hidden" name="title" value="Username"> right after the button.

Due to this part of your code: https://github.com/Nevallem/mw-gadget-requestForAdminship/blob/main/src/core.js#L429.

By input[name="title"], you probably meant to select one of the two fields at https://pt.wikipedia.org/wiki/Wikip%C3%A9dia:Administradores/Pedidos_de_aprova%C3%A7%C3%A3o. But there are also hidden inputs that the search button uses.

So get a better, more specific selector.

Also keep in mind: selecting elements with [prop=abc] is a bad idea, precisely due to risks like this. Use a class, or better yet, an ID, that's sure to not be ambiguous.

Thanks Alien333! Bug fixed.