Page MenuHomePhabricator

UploadWizard can overwrite existing files uploaded in the same session before clicking "Upload more files"
Closed, ResolvedPublic

Description

I've had this bug before when using Upload Wizard, but I couldn't reproduce it, so I left it there. I've just come across the same bug again, so here are the steps to reproduce it. 1) Upload an image and give it a file name "somename1.jpg" 2) When populating categories, enter a category that doesn't exist 3) Publish the page ignoring the warning pop-up by clicking OK 4) Click on Upload more files 5) Upload a different image 6) Give it (accidentally) the same name "somename1.jpg" Right there is the bug! Upload Wizard does not recognize this file name as a duplicate. When you proceed to publish it, instead of reporting the error, the process continues and the second image overwrites the first image on the previously published page. I've reproduced the bug using the steps, and here's the result: https://commons.wikimedia.org/wiki/File:Wikimedia_Upload-Wizard-Bug-Test_2017-11-07.jpg

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 7 2017, 6:32 PM
Restricted Application added a project: Multimedia. · View Herald TranscriptNov 7 2017, 6:33 PM

Thank you, this is actually probably very helpful, I think there have been a few reports of this occurring (UploadWizard overwriting previously uploaded files) but no one knew why.

matmarex renamed this task from Wikimedia Upload Wizard bug to be corrected to UploadWizard can overwrite existing files uploaded in the same session before clicking "Upload more files".Nov 7 2017, 6:53 PM
matmarex added a subscriber: Nicolas_Raoul.

Maybe the non-existing category isn't significant. The file in the merged duplicate T178555 was uploaded with a valid category created in 2012.

Yeah, I'm not sure about that part (it might be not significant, or it might be just something with the warning pop-up rather than the specific warning about categories), but everything else sounds plausible. UploadWizard probably caches the results of looking up file existence somewhere internally, and does not update this when uploading a file.

I've just performed a test with entering an existing category this time. That part is actually not significant, so it does not matter whether or not a category exists. Here's the resulting page: https://commons.wikimedia.org/wiki/File:Wikimedia_Upload-Wizard-Bug-Test_2017-11-07_(3).jpg

My-wiki-photos added a comment.EditedNov 7 2017, 9:51 PM

So, here are the steps to reproduce the bug. 1) Upload an image 2) Give it a file name/title "somename1.jpg" 3) Publish the page 4) Click on "Upload more files" 5) Upload a different image 6) Give it (accidentally) the same file name/title "somename1.jpg" 7) Publish the page. Due to the bug, the second image overwrites the first image on the first published page. The second page is never published.

Ramsey-WMF triaged this task as Normal priority.
Ramsey-WMF assigned this task to Cparle.
Ramsey-WMF added a subscriber: Ramsey-WMF.
Ramsey-WMF moved this task from Untriaged to Next up on the Multimedia board.Nov 16 2017, 5:48 PM

Change 392445 had a related patch set uploaded (by Cparle; owner: Cparle):
[mediawiki/extensions/UploadWizard@master] Clear result cache on checkUnique when upload complete

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

Change 392445 merged by jenkins-bot:
[mediawiki/extensions/UploadWizard@master] Clear result cache on checkUnique when upload complete

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

Looking good for me. I am seeing a duplicate file warning/error on beta commons

@My-wiki-photos this is now fixed on beta see https://en.wikipedia.beta.wmflabs.org/wiki/Main_Page if you'd like to check it

matthiasmullie closed this task as Resolved.Nov 21 2017, 3:35 PM

@Cparle I could not test it on Beta, because I didn't have an account on it. Even though I just created an account on Beta, I still could not use the UploadWizard, as there are additional requirements that must be met to become an autoconfirmed user. Thank you!

@My-wiki-photos ok - it's scheduled for deployment to test.wikipedia.org on Tuesday and then should be on commons the following Thursday. If you spot any problems with it let me know