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 created this task.Oct 18 2015, 9:33 PM
Reedy raised the priority of this task from to Needs Triage.
Reedy updated the task description. (Show Details)
Reedy added a subscriber: Reedy.
Restricted Application added subscribers: Steinsplitter, Matanya, Aklapper. · View Herald TranscriptOct 18 2015, 9:33 PM

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 removed a subscriber: matmarex.Oct 18 2015, 9:50 PM
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.
Tgr added a subscriber: Tgr.Oct 19 2015, 5:18 AM

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.

Reedy added a subscriber: matmarex.Oct 19 2015, 9:54 AM

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

Tgr added a comment.Oct 20 2015, 1:24 AM

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.

Reedy added a comment.Oct 20 2015, 7:20 AM

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
Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptNov 15 2015, 1:50 PM
MarkTraceur triaged this task as Normal priority.Dec 21 2015, 3:22 PM
MarkTraceur moved this task from Untriaged to Triaged on the Multimedia board.Dec 5 2016, 9:42 PM
MarkTraceur moved this task from Triaged to Next up on the Multimedia board.Jun 5 2017, 3:27 PM

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.

matthiasmullie moved this task from Next up to Needs code review on the Multimedia board.

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

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

matthiasmullie closed this task as Resolved.Sep 15 2017, 11:54 AM