Page MenuHomeMiraheze

MSUpload errors and bugs
Open, NormalPublic

Description

Ever since the 1.38 upgrade, I wasn't able to properly upload my images to the CLG Wiki. While using the MSUpload extension, when I drop my files into the site and try uploading it, this message keeps popping up:
"Error: unknown error."
However, I tried doing the same action again and got it uploaded to the site. But a bigger issue I have is when I upload multiple images. For some reason, the extension mixes up the file names for all of my uploads, forcing me to go back and change the files to where I intended them to go.

Event Timeline

Universal_Omega moved this task from Backlog to Deployed Extension Bugs on the Extensions board.
Universal_Omega moved this task from Backlog to Short Term on the MediaWiki (SRE) board.

I have this issue too.

Sometimes, MSUpload POST to the API, but without any "action" parameter, only "name" and "file", like this:

-----------------------------xxx
Content-Disposition: form-data; name="name"

<File name of the current upload>
-----------------------------xxx
Content-Disposition: form-data; name="file"
Content-Type: image/png

<Binary data of the current upload>

Since there is no action, that API will return the documentation in HTML format instead.
MSUpload can't handle non-JSON responses, so it will throw "Error: unknown error".

After the error if I'm not mistaken, sometimes MSUpload will retry the failed upload.
It will correctly send the "action" param this time along with the "file" of the previous file.
BUT (this is the important part!), somehow it will also merge the request with the snippet above.
Both "name" and (another) "file" param is based on the next file.

Something like this:

-----------------------------xxx
Content-Disposition: form-data; name="filename"

<File name of the previous error upload>
-----------------------------xxx
Content-Disposition: form-data; name="action"

upload
-----------------------------xxx
Content-Disposition: form-data; name="file"
Content-Type: image/png

<Binary data of the previous error upload>
-----------------------------xxx
Content-Disposition: form-data; name="name"

<File name of the next file>
-----------------------------xxx
Content-Disposition: form-data; name="file"
Content-Type: image/png

<Binary data of the next file>

"Name" param is not needed by the upload API, and only the last binary data is taken.
The result: Binary data of the next file + file name of the previous error upload.

When there are 2 files, A and B, probably A is not uploaded, and B is uploaded with A filename.
Or, A is uploaded, and B will be uploaded again replacing the A file. The filename is off by one file sequentially.

But when there are more files, let's say A, B, C, D, E, and encountered are a lot of errors,
It's even possible that E will be uploaded using A filename.