jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1092833?usp=email )
Change subject: [bugfix] Upcast to FilePage in PageGenerator.result() ...................................................................... [bugfix] Upcast to FilePage in PageGenerator.result() Upcast to FilePage in api.PageGenerator.result if pagedata has imageinfo contents even if the file extension is invalid. Bug: T379513 Change-Id: Ieb5f3c802569a13c0ed96ee5290aa4de799e1b8b --- M pywikibot/data/api/_generators.py 1 file changed, 6 insertions(+), 2 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/pywikibot/data/api/_generators.py b/pywikibot/data/api/_generators.py index 1a316e9..fdf941a 100644 --- a/pywikibot/data/api/_generators.py +++ b/pywikibot/data/api/_generators.py @@ -727,9 +727,12 @@ of object. .. versionchanged:: 9.5 - no longer raise :exc:`exceptions.UnsupportedPageError` but + No longer raise :exc:`exceptions.UnsupportedPageError` but return a generic :class:`pywikibot.Page` obect. The exception is raised when getting the content for example. + .. versionchanged:: 9.6 + Upcast to :class:`page.FilePage` if *pagedata* has + ``imageinfo`` contents even if the file extension is invalid. """ p = pywikibot.Page(self.site, pagedata['title'], pagedata['ns']) ns = pagedata['ns'] @@ -738,7 +741,8 @@ p = pywikibot.User(p) elif ns == Namespace.FILE: with suppress(ValueError): - p = pywikibot.FilePage(p) + p = pywikibot.FilePage( + p, ignore_extension='imageinfo' in pagedata) elif ns == Namespace.CATEGORY: p = pywikibot.Category(p) -- To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1092833?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: Ieb5f3c802569a13c0ed96ee5290aa4de799e1b8b Gerrit-Change-Number: 1092833 Gerrit-PatchSet: 1 Gerrit-Owner: Xqt <i...@gno.de> Gerrit-Reviewer: JJMC89 <jjmc89.wikime...@gmail.com> Gerrit-Reviewer: Prod <prodig...@hotmail.com> Gerrit-Reviewer: Xqt <i...@gno.de> Gerrit-Reviewer: jenkins-bot
_______________________________________________ Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org