Page MenuHomePhabricator

Error after "Upload more files" (already uploading the file...)
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
Eihel
Oct 15 2019, 5:36 PM
Referenced Files
Restricted File
Jun 21 2023, 7:48 PM
Restricted File
Jun 21 2023, 7:48 PM
Restricted File
Jun 21 2023, 7:48 PM
Restricted File
Jun 21 2023, 7:48 PM
F37111441: obraz.png
Jun 21 2023, 7:41 PM
F37111443: obraz.png
Jun 21 2023, 7:41 PM
F30722100: 2nd problem - Continue with same forms.jpg
Oct 15 2019, 5:36 PM
F30721922: 2nd problem - Error.jpg
Oct 15 2019, 5:36 PM
Tokens
"Like" token, awarded by Samwilson.

Description

Hello,
On Wikimedia Commons, a new image can not be transferred directly after clicking on the button "Upload more files" with Upload Wizard.

Steps to Reproduce:

  1. Transfer an image normally via Upload Wizard – e.g. https://test.wikipedia.org/wiki/Special:UploadWizard
  2. At the end, click on "Upload more files" button
  3. Click on "Select media files to share" and load a new file (file with a different name!)

Actual Results:

A window appears with the title There was an error in your submission. And the message is You are already uploading the file blablabla.jpg.

The forms are also pre-filled with the old entries.

Refresh (F5) the page allows me to put a new file correctly (this is a temporary solution).

Expected Results:

The old file should not conflict with a new file.

Additional info

Error message:

2nd problem - Error.jpg (508×917 px, 60 KB)

The forms pre-filled with the old entries:

2nd problem - Continue with same forms.jpg (443×719 px, 62 KB)

Event Timeline

Aklapper renamed this task from Error after "Upload more files" to Error after "Upload more files": "You are already uploading the file ...".Oct 25 2019, 11:56 AM
Eihel renamed this task from Error after "Upload more files": "You are already uploading the file ..." to Error after "Upload more files".Oct 28 2019, 2:02 PM
This comment was removed by Eihel.
Eihel renamed this task from Error after "Upload more files" to Error after "Upload more files" (already uploading the file...).Oct 28 2019, 2:32 PM

I wonder when this little error will be taken care of :)

The forms are also pre-filled with the old entries.

I feel like this is the desired behaviour here (although I might be wrong). The only reason I use 'upload more files' is because it means I don't have to re-fill the source, author, and license. If I'm uploading a whole new set of files, I can just fit F5 and start the form fresh.

The bug here is only the "already uploading" message.

I can just fit F5 and start the form fresh.

Hello @Samwilson,
There, it is not a choice: the first thing you see after clicking on the "Upload more files" button is the selection of an image (upload or Flickr). The error occurs after selecting a new image, so it has never been included in Commons (see the image at the top of this page). By clicking OK, the work can continue. I do not see the interest of F5, otherwise remove the button "Upload more files" and click on the link in the left menu. Cordially.

More detailed steps to reproduce:

  1. Transfer one or more images normally e.g. file "Example - first batch 1.png"
  2. At the end, click on "Upload more files" button.
  3. Click on "Select media files to share" and load a new file e.g. "Example - second batch 2.png"
  4. There is a warning saying "Example - second batch 2.png" was already uploaded (which is not true).

Reproduction with images.

Sent this files:
2023-02-14 16.00 -- Wieża Mon Plasir - wnętrze.jpg
2023-02-14 16.00 -- Wieża Mon Plasir - wejście.jpg

obraz.png (701×1 px, 261 KB)

As you can see I even changed their names (there was a typo and wrong dashes).

In 2nd batch I was about to upload this files:
2023-02-14 16.00 -- Wieża Mon Plaisir - front.jpg
2023-02-14 16.00 -- Wieża Mon Plaisir - piwniczka.jpg

obraz.png (1×1 px, 270 KB)

So this message doesn't make sense:

Wystąpił błąd podczas przesyłania
Przesłałeś już plik „2023-02-14 16.00 -- Wieża Mon Plaisir - front.jpg“.

i18n key of "Przesłałeś już plik" is "mediauploader-upload-error-duplicate-filename-error".

API response 1st and 2nd batch:
{F37111457}
{F37111458}
{F37111459}
{F37111460}

There are too many files-added events.

This is what happens for 3rd batch:

  1. 22:29:39.978 files-added: 0806 - cmentarz.JPG load.php:2899:31
  2. 22:29:39.983 validate: 0806 - cmentarz.JPG load.php:3046:21
  3. 22:29:39.993 files-added: 3 load.php:2899:31
  4. 22:29:40.002 files-added: 0806 - cmentarz.JPG load.php:2899:31
  5. 22:29:40.006 validate: 0806 - cmentarz.JPG load.php:3046:21
  6. 22:29:40.009 files-added: 0806 - cmentarz.JPG load.php:2899:31
  7. 22:29:40.013 validate: 0806 - cmentarz.JPG

On 4th batch – yes, there are even more events ;-):

  1. 22:40:31.181 files-added: 0806 - cmentarz.JPG load.php:2899:31
  2. 22:40:31.186 validate: 0806 - cmentarz.JPG load.php:3046:21
  3. 22:40:31.198 files-added: 4 load.php:2899:31
  4. 22:40:31.208 files-added: 0806 - cmentarz.JPG load.php:2899:31
  5. 22:40:31.211 validate: 0806 - cmentarz.JPG load.php:3046:21
  6. 22:40:31.214 files-added: 0806 - cmentarz.JPG load.php:2899:31
  7. 22:40:31.218 validate: 0806 - cmentarz.JPG load.php:3046:21
  8. 22:40:31.221 files-added: 0806 - cmentarz.JPG load.php:2899:31
  9. 22:40:31.223 validate: 0806 - cmentarz.JPG

Logs:

  • files-added log on line: var totalFiles = files.length + step.uploads.length,
  • validate log on line: basename = upload.getBasename();

Related: T96916
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UploadWizard/+/325559/5/resources/controller/uw.controller.Upload.js

PS: In case you were wondering – no, it doesn't matter if you are dropping files (drag & drop) or if you choose them with a more standard dialog. Number of events is the same. Number of events depends on the number of batches.

So this is called multiple times uw.ui.Upload.prototype.load = function (uploads).

Easiest fix would be to add a flag there. E.g.:

	uw.ui.Upload.prototype.load = function ( uploads ) {
		var ui = this;
		
		if ( this._loadDone ) {
			return false;
		}

		uw.ui.Step.prototype.load.call( this, uploads );

		if ( uploads.length === 0 ) {
			this.$fileList.removeClass( 'mediauploader-filled-filelist' );
		}

		this.$div.prepend(
			$( '<div>' )
				.attr( 'id', 'mediauploader-files' )
				.append(
					this.$fileList,
					this.$uploadCtrl
				)
		);

		this.addFile.on( 'change', function ( files ) {
			ui.emit( 'files-added', files );
			ui.addFile.setValue( null );
		} );

		this._loadDone = true;
		return true;
	};

Though I'm not sure if uw.ui.Step.prototype.load.call( this, uploads ); need to be called each time. Don't seem like it but someone would have to test it.

Change 932824 had a related patch set uploaded (by Eccenux; author: Eccenux):

[mediawiki/extensions/UploadWizard@master] Upload Wizard error on 2nd batch

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

Nux removed a project: Patch-For-Review.

Sorry, I wasn't able to test it before the review. I will need to install the latest MW, but not sure when will I have enough time to do so as I am on and off from home...

Nux reopened this task as In Progress.Jul 26 2023, 10:35 PM

Sorry, I wasn't able to test it before the review. I will need to install the latest MW, but not sure when will I have enough time to do so as I am on and off from home...

You can test UploadWizard patches on https://patchdemo.wmflabs.org if you're having trouble installing it.

Change 969699 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/UploadWizard@master] Move "files-added" event code so it doesn't trigger twice

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

Change 932824 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/extensions/UploadWizard@master] Upload Wizard error on 2nd batch

Reason:

Replaced by Id795655.

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

Change 969699 merged by jenkins-bot:

[mediawiki/extensions/UploadWizard@master] Move "files-added" event code so it doesn't trigger twice

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

Thanks for the fix. That seems like a less invasive way then I wanted to do it.

Seems to be working fine on Firefox 119 on Windows 10 ✅.

  1. Cannot reproduce my steps anymore.
  2. The message "You are already uploading the file ..." does appear when you select the same image twice (twice in the same batch).

The wizard URL to try (creating an account is required):
https://patchdemo.wmflabs.org/wikis/f92bb52110/wiki/Special:UploadWizard