Closed exander77 closed 3 years ago
I had been happily using V0.30 of wiki-java since 2013 until I hit this problem uploading svg images. Hoping it would fix it I upgraded to the latest version, but same problem. This leads me to suspect that the issue is not with wiki-java API but with the Wikipedia/Wikimedia implementation that is being called.
@easty77 Yes, they probably deprecated some APIs and wiki-java was not prepared for it.
So issue is in creating of POST parameters. Output is something like this:
------------NEXT PART----------
"Content-Disposition: form-data; name=\""
filesize"
Content-Type: text/plain; charset=UTF-8
5007661
------------NEXT PART----------
"Content-Disposition: form-data; name=\""
offset"
Content-Type: text/plain; charset=UTF-8
0
I am proposing change to something like:
------------NEXT PART----------
Content-Disposition: form-data; name="filesize"
Content-Type: text/plain; charset=UTF-8
5007661
------------NEXT PART----------
Content-Disposition: form-data; name="offset"
Content-Type: text/plain; charset=UTF-8
0
Fix works well for me regarding the missing token error. Thank you.
However for one of the 5 files I loaded to test I received the following error: error code="badupload" info="The file for "file" was only partially uploaded." xml:space="preserve" I have not seen this before and I was able to upload the file (svg) without issues using the Upload wizard.
I am calling the wiki-java API directly in a Java application.
@easty77 Which error? (I don't see any). And which tool you are using? (I am testing this in Vicuna)
Edited answer above with requested details.
@easty77 It is a random image or concrete image type or file?
@easty77 I uploaded normally by development version of Vicuna (https://commons.wikimedia.org/wiki/File:Owner_Rolf_Siepmann2.svg)
ok, let's forget about that glitch. I'll report back if I experience such issues more regularly. It certainly seems that the missing token issue has now been fixed. Thanks.
@MER-C Could we merge this PR (#185)?
It's merged. If this issue persists please reopen.
I reproduce the same error as Commonist when uploading images (upload method):
https://commons.wikimedia.org/wiki/Commons_talk:Commonist