Page MenuHomePhabricator

Special:Upload shouldn't try stashing files for anonymous users
Closed, ResolvedPublic

Description

Uploading a file on my dev wiki not logged in...

Why must files belong to users? What's wrong with Anons?

[581c4356] /wiki/Special:Upload UploadStashNotLoggedInException from line 272 of /var/www/wiki/mediawiki/core/includes/upload/UploadStash.php: UploadStash::stashFile No user is logged in, files must belong to users

Backtrace:

#0 /var/www/wiki/mediawiki/core/includes/upload/UploadBase.php(922): UploadStash->stashFile(string, string)
#1 /var/www/wiki/mediawiki/core/includes/upload/UploadBase.php(935): UploadBase->stashFile()
#2 /var/www/wiki/mediawiki/core/includes/upload/UploadBase.php(944): UploadBase->stashFileGetKey()
#3 /var/www/wiki/mediawiki/core/includes/specials/SpecialUpload.php(359): UploadBase->stashSession()
#4 /var/www/wiki/mediawiki/core/includes/specials/SpecialUpload.php(473): SpecialUpload->showUploadWarning(array)
#5 /var/www/wiki/mediawiki/core/includes/specials/SpecialUpload.php(197): SpecialUpload->processUpload()
#6 /var/www/wiki/mediawiki/core/includes/specialpage/SpecialPage.php(384): SpecialUpload->execute(NULL)
#7 /var/www/wiki/mediawiki/core/includes/specialpage/SpecialPageFactory.php(553): SpecialPage->run(NULL)
#8 /var/www/wiki/mediawiki/core/includes/MediaWiki.php(248): SpecialPageFactory::executePath(Title, RequestContext)
#9 /var/www/wiki/mediawiki/core/includes/MediaWiki.php(668): MediaWiki->performRequest()
#10 /var/www/wiki/mediawiki/core/includes/MediaWiki.php(474): MediaWiki->main()
#11 /var/www/wiki/mediawiki/core/index.php(41): MediaWiki->run()
#12 {main}

Event Timeline

Reedy raised the priority of this task from to Needs Triage.
Reedy updated the task description. (Show Details)
Reedy subscribed.

Stashed files must belong to users because the database schema doesn't allow otherwise.

Special:Upload shouldn't try stashing files when you're anonymous, I guess.

matmarex renamed this task from Why must files belong to users? to Why must stashed files belong to users?.Oct 18 2015, 10:08 PM
matmarex set Security to None.

The stash is private (has to be; at this point the file has no license yet). How do you provide private access to an anonymous user? I guess it could be done via some token system, but it's not a trivial change.

The stash is private (has to be; at this point the file has no license yet). How do you provide private access to an anonymous user? I guess it could be done via some token system, but it's not a trivial change.

Special:Upload shouldn't try stashing files when you're anonymous, I guess.

I guess that should be the minimal fix; it shouldn't end in an exception. Whether anonymous users can actually "use" the stash is up for debate, and something that can be worked on longer term

Special:Upload shouldn't try stashing files when you're anonymous, I guess.

Does it even work (when you are logged in)? The purpose seems to be to be able repost the form after a warning without reuploading the file, but I just get an error message about empty files when I try to do that.

Yeah, it seemed to be working with the PDF from T115813. I think it failed, as the pdf was taking a long time to process, and when I went back to the tab, it'd lost session data

matmarex renamed this task from Why must stashed files belong to users? to Special:Upload shouldn't try stashing files for anonymous users.Oct 23 2015, 12:30 AM

Change 365607 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/core@master] Instruct stashed upload failures to reupload file

https://gerrit.wikimedia.org/r/365607

By now, this exception no longer happens and you'll just see the form to reupload the file & correct the description.
I've submitted another patch that'll just change the warning message, instructing those where a stash failed to reupload their file as well.

Change 365607 merged by jenkins-bot:
[mediawiki/core@master] Instruct stashed upload failures to reupload file

https://gerrit.wikimedia.org/r/365607