Closed hugolpz closed 3 years ago
After uploading the 2 files above to Github... Just for fun, I tried to change the file_path
value from local path into the github url path https://user-images.githubusercontent.com/1420189/112379664-b9a79100-8ce8-11eb-981d-727884b32993.png
. And.... it works ! See On Commons (if no admin delete it). Since the local path is correct, it's very likely an issue with local file reading.
I provided my whole code so you may easily test it if you wish.
EDIT: please note i am importing
//const fetch = require('node-fetch'); // url
//const fs = require('fs'); // local path
Which may mess up some of your code ?? EDIT: I shifted these two lines into comments and same error messages occurs.
The two situations are not the same.
You may try{...}catch(e){console.error(e);}
to see what happens.
Oh. I. See..... 🤩
1) commons-upload.js now returns :
to_form_data: Failed to get file: [./reds/png/a-red.png]
{
code: 'missingparam',
info: 'One of the parameters "filekey", "file" and "url" is required.',
'*': 'See https://commons.wikimedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.'
}
On Commons's API > Upload we can read:
It tried some stuffs with fs.read()
but doesn't work.
So I'am lost. 😬 Your help is welcome to interpret the error above.
EDIT: move distinct rename error to distinct issue.
It should works now.
It does better but there is still a bump. If you are in Taiwan as I believe I prefer to report you this issue tomorrow. 👍🏼 🌃
OK. 😺 Please open a new issue.
I cleaned up the issue and split it. Done for today. I will open other issues later this week.
See #26 #27.
commons-upload.js:
Then:
I copy-pasted that url into my Chrome and boom ! The images shows up. So the path is correct.
Example file, to save as
丁-red.png
: 丁-red.pngASCII file, to save as
a-red.png
: a-red.pngBoth
丁-red.png
anda-red.png
returns the same error message, so it's not encoding.