[go: up one dir, main page]

Page MenuHomePhabricator

Special:Upload redirects after loading
Closed, ResolvedPublicBUG REPORT

Description

For about two weeks, Special:Upload on Commons has been redirecting after loading the page. Not only is this annoying and disruptive - it's often delayed by several seconds, so the page redirects while the "choose file" dialogue is open - but it redirects to the plain upload form that lacks the Preview button. The ability to preview is extremely important; I can't imagine why it's been taken away.

https://commons.wikimedia.org/wiki/Special:Upload
redirects to
https://commons.wikimedia.org/wiki/Special:Upload?uploadformstyle=plain

This also occurs when the form style is explicitly set:
https://commons.wikimedia.org/wiki/Special:Upload?uploadformstyle=basic
redirects to
https://commons.wikimedia.org/wiki/Special:Upload?uploadformstyle=basic&uploadformstyle=plain

Event Timeline

Hi @Pi.1415926535, thanks for taking the time to report this!
I cannot reproduce when using https://commons.wikimedia.org/wiki/Special:Upload?safemode=1 .
See https://www.mediawiki.org/wiki/Help:Locating_broken_scripts for more information.
So I'd assume that this might be a local change by the Commons community.
Have you discussed this in a Commons forum beforehand? Please link to that discussion - thanks!

Discussion is here: https://commons.wikimedia.org/wiki/Commons:Village_pump#Special:Upload_appears_to_be_broken

Turning off the Improved Upload Form did fix the redirect issue for me, but also removes the preview button.

The code is custom on-wiki content, so it's up to the Commons community to look into this...

The code is custom on-wiki content, so it's up to the Commons community to look into this...

First checked on Commons. https://commons.wikimedia.org/wiki/MediaWiki:UploadForm.js hasn't been changed since 2021. I looked at the recent changes for the MediaWiki namespace: https://commons.wikimedia.org/wiki/Special:RecentChanges?hidebots=1&hidecategorization=1&hideWikibase=1&namespace=8&limit=500&days=30&enhanced=1&urlversion=2 and don't see any obvious changes that could have caused it. The gadget is at https://commons.wikimedia.org/wiki/MediaWiki:Gadget-ImprovedUploadForm.js and last updated in 2019

Url to reproduce it: https://commons.wikimedia.org/w/index.php?title=Special:Upload&wpDestFile=US_timeline._Drugs_involved_in_overdose_deaths.jpg&wpForReUpload=1 . It will redirect to https://commons.wikimedia.org/w/index.php?title=Special:Upload&wpDestFile=US_timeline._Drugs_involved_in_overdose_deaths.jpg&wpForReUpload=1&uploadformstyle=plain . If you disable the "ImprovedUploadForm" gadget it won't happen anymore.

I see some related changes in T341349 and T343581. Might this have triggered it? Help appreciated.

matmarex subscribed.

The redirect happens in the gadget code here: https://commons.wikimedia.org/w/index.php?title=MediaWiki:UploadForm.js&oldid=552469846#L-1208

As a result of this error:

TypeError: field.parentNode.parentNode.cells is undefined
    setHelp https://commons.wikimedia.org/w/index.php?title=MediaWiki:UploadForm.js&action=raw&ctype=text/javascript:654
    setupHelp https://commons.wikimedia.org/w/index.php?title=MediaWiki:UploadForm.js&action=raw&ctype=text/javascript:740
    setupHelp https://commons.wikimedia.org/w/index.php?title=MediaWiki:UploadForm.js&action=raw&ctype=text/javascript:739
    reallyInstall https://commons.wikimedia.org/w/index.php?title=MediaWiki:UploadForm.js&action=raw&ctype=text/javascript:1186
    reallyInstall https://commons.wikimedia.org/w/index.php?title=MediaWiki:UploadForm.js&action=raw&ctype=text/javascript:1158
    setTimeout handler*reallyInstall https://commons.wikimedia.org/w/index.php?title=MediaWiki:UploadForm.js&action=raw&ctype=text/javascript:1157
    install https://commons.wikimedia.org/w/index.php?title=MediaWiki:UploadForm.js&action=raw&ctype=text/javascript:1265
    <anonymous> https://commons.wikimedia.org/w/index.php?title=MediaWiki:UploadForm.js&action=raw&ctype=text/javascript:3056
    <anonymous> https://commons.wikimedia.org/w/index.php?title=MediaWiki:UploadForm.js&action=raw&ctype=text/javascript:3058

It's trying to make some modifications to the table row containing the file input <input id="wpUploadFile" name="wpUploadFile" size="60" type="file"> (in order to tweak some labels or something), but it's failing because the file input is now wrapped in <div class="cdx-text-input">…</div>.

I'm not sure where this wrapper is coming from, and I don't feel like finding out (but it's definitely not related to T341349 or T343581). It seems like it might have been added unintentionally…

This should fix the script, and avoid similar errors in the future: https://commons.wikimedia.org/w/index.php?title=MediaWiki:UploadForm.js&diff=prev&oldid=793770585

Works for me now.

cdx-text-input is for codex, was added in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/919361 - UploadSourceField extends the changed HTMLTextField

Thanks matmarex! I can confirm that both the redirecting and the javascript error popup are gone for me.