zhuyifei1999 created this task. zhuyifei1999 added subscribers: zhuyifei1999, XZise. zhuyifei1999 added projects: pywikibot-core, Pywikibot-General. Restricted Application added subscribers: Aklapper, pywikipedia-bugs.
TASK DESCRIPTION On an upload of "File:Scanwings, OH-BCX, Beechcraft C90 King Air (17512831479).jpg" to Commons:
Using HEAD, upload fail with a loophole of
``` ERROR: Traceback (most recent call last): File "/data/project/yifeibot/pywikibot/pywikibot/data/api.py", line 1555, in submit body=body, headers=headers) File "/data/project/yifeibot/pywikibot/pywikibot/tools/__init__.py", line 950, in wrapper return obj(*__args, **__kw) File "/data/project/yifeibot/pywikibot/pywikibot/comms/http.py", line 269, in request r = fetch(baseuri, method, body, headers, **kwargs) File "/data/project/yifeibot/pywikibot/pywikibot/comms/http.py", line 370, in fetch error_handling_callback(request) File "/data/project/yifeibot/pywikibot/pywikibot/comms/http.py", line 287, in error_handling_callback raise request.data UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 1872: ordinal not in range(128)
WARNING: Waiting 5 seconds before retrying. ```
After debugging, I found all versions after 1e54a7d6886d56a21101900025038e25bab5ad03 has the same error, while version before raises an (expected) exception that is handled in botscript:
``` KeyError: u'bad-prefix' ``` (raised in https://github.com/wikimedia/mediawiki/blob/84899f991ff44f36b7359f0bbf8de295...)
I agree that some errors should be prevented from uploading. But why is there a UnicodeDecodeError leading to a loophole?
TASK DETAIL https://phabricator.wikimedia.org/T99366
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: zhuyifei1999 Cc: XZise, Aklapper, zhuyifei1999, jayvdb, pywikipedia-bugs