jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
FilePage: Ignore revision with 'filemissing' field

According to gerrit:533482, entries with the 'filemissing' field omit the
following fields: 'timestamp', 'userhidden', 'user', 'userid', 'anon', 'size',
'width', 'height', 'pagecount', 'duration', 'commenthidden', 'parsedcomment',
'comment', 'thumburl', 'thumbwidth', 'thumbheight', 'thumbmime', 'thumberror',
'url', 'sha1', 'metadata', 'extmetadata', 'commonmetadata', 'mime',
'mediadtype', 'bitdepth'.

This means that the revision is unusable for all intents and purposes, so we
just throw a warning and ignore it.

Bug: T233959
Change-Id: I76d12a4558de9c21464ec63e9b780736ee47e405
---
M pywikibot/page.py
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 33176bf..5fa4c69 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2480,6 +2480,12 @@

def _load_file_revisions(self, imageinfo):
for file_rev in imageinfo:
+ # filemissing in API response indicates most fields are missing
+ # see https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/533482/
+ if 'filemissing' in file_rev:
+ pywikibot.warning("File '%s' contains missing revisions"
+ % self.title())
+ continue
file_revision = FileInfo(file_rev)
self._file_revisions[file_revision.timestamp] = file_revision


To view, visit change 539357. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I76d12a4558de9c21464ec63e9b780736ee47e405
Gerrit-Change-Number: 539357
Gerrit-PatchSet: 3
Gerrit-Owner: Strainu <wiki@strainu.ro>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)