Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Image upload fails #184

Closed
exander77 opened this issue Oct 12, 2021 · 13 comments
Closed

Image upload fails #184

exander77 opened this issue Oct 12, 2021 · 13 comments

Comments

@exander77
Copy link

I reproduce the same error as Commonist when uploading images (upload method):

{"code":"missingparam","info":"The \"token\" parameter must be set.","*":"See somewhere something..."}

https://commons.wikimedia.org/wiki/Commons_talk:Commonist

@easty77
Copy link

easty77 commented Oct 13, 2021

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.

@exander77
Copy link
Author

@easty77 Yes, they probably deprecated some APIs and wiki-java was not prepared for it.

@michal-josef-spacek
Copy link
Contributor

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

@michal-josef-spacek
Copy link
Contributor

PR in #185

@easty77
Copy link

easty77 commented Oct 18, 2021

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.

@michal-josef-spacek
Copy link
Contributor

@easty77 Which error? (I don't see any). And which tool you are using? (I am testing this in Vicuna)

@easty77
Copy link

easty77 commented Oct 18, 2021

Edited answer above with requested details.

@michal-josef-spacek
Copy link
Contributor

@easty77 It is a random image or concrete image type or file?

@easty77
Copy link

easty77 commented Oct 18, 2021

https://commons.wikimedia.org/wiki/File:Owner_Rolf_Siepmann.svg

@michal-josef-spacek
Copy link
Contributor

@easty77 I uploaded normally by development version of Vicuna (https://commons.wikimedia.org/wiki/File:Owner_Rolf_Siepmann2.svg)

@easty77
Copy link

easty77 commented Oct 19, 2021

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.

@michal-josef-spacek
Copy link
Contributor

michal-josef-spacek commented Oct 19, 2021

@MER-C Could we merge this PR (#185)?

@MER-C
Copy link
Owner

MER-C commented Oct 19, 2021

It's merged. If this issue persists please reopen.

@MER-C MER-C closed this as completed Oct 19, 2021
Abbe98 added a commit to Kartkod/pattypan that referenced this issue Oct 29, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants