Page MenuHomePhabricator

ApiError on chunked upload with callable ignore_warnings
Closed, ResolvedPublic

Description

Calling site.upload() with a non-zero chunk_size and an callable ignore_warnings results in the following error message when an allowed warning is raised:

Error: File:Foo.jpg: badparams: Cannot supply a filekey when offset is 0 [help:See https://commons.wikimedia.org/w/api.php for API usage]

This happens because of [[ https://github.com/wikimedia/pywikibot-core/blob/master/pywikibot/site.py#L6100 | if 'offset' not in data: data['offset'] = True ]] (introduced in https://gerrit.wikimedia.org/r/#/c/234851/)
which sets offset = True on line 6106 thus passing offset: True to the mediawiki api when the continue brings the proces back to line 6072.

Event Timeline

Change 323396 had a related patch set uploaded (by Lokal Profil):
Recover from an allowed warning in the first chunk of an upload

https://gerrit.wikimedia.org/r/323396

Note that the patch just sidesteps the underlying issues mentioned in T112543, T112405#1637544, T112416.

It might also affect T133288.

Just as before there might be warnings in later chunks or on completion which are completely ignored if an allowed warning occurs in the first chunk.

In particular this affects the exists warning triggered in the first chunk which then hides the duplicate warning on completion.

Dalba assigned this task to Lokal_Profil.

Change 323396 merged by jenkins-bot:
Recover from an allowed warning in the first chunk of an upload

https://gerrit.wikimedia.org/r/323396