jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Allow missing offset in chunked uploads ......................................................................
[FIX] Allow missing offset in chunked uploads
As described in the first comment of bug 71727, the MediaWiki server might return no offset (bug 71737). It then calculates the offset by adding the chunk size to it and emits a warning.
Change-Id: I88107f45d47efa01ec0911636d160ada60ffd610 --- M pywikibot/site.py 1 file changed, 8 insertions(+), 4 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py index de30eda..fe0eb02 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -4358,10 +4358,14 @@ break file_key = data['filekey'] throttle = False - new_offset = int(data['offset']) - if offset + len(chunk) != new_offset: - pywikibot.warning('Unexpected offset.') - offset = new_offset + if 'offset' in data: + new_offset = int(data['offset']) + if offset + len(chunk) != new_offset: + pywikibot.warning('Unexpected offset.') + offset = new_offset + else: + pywikibot.warning('Offset was not supplied.') + offset += len(chunk) if data['result'] != 'Continue': # finished additional_parameters['filekey'] = file_key break
pywikibot-commits@lists.wikimedia.org