From 261e3354f727203f3208b0a5e385b5ba0ac98cd9 Mon Sep 17 00:00:00 2001 From: Sam Wilson Date: Wed, 21 Aug 2024 07:27:54 +0800 Subject: [PATCH] Check for imageinfo rather than missing or invalid Because shared-repo images are reported as missing, do not check for that status. And to make things simpler, use the same handling for invalid ones as well, and just check to see if any imageinfo metadata has been returned (that's all we're interested in, after all). This is a follow-up to GH #512. Bug: T372956 --- src/BookProvider.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/BookProvider.php b/src/BookProvider.php index d7ea296..d22f494 100644 --- a/src/BookProvider.php +++ b/src/BookProvider.php @@ -304,10 +304,9 @@ public function getCover( $cover ): ?Picture { 'iiurlwidth' => $width, 'formatversion' => 2, ] )->wait(); - // Give up for invalid cover titles or those that do not exist. + // Give up if no imageinfo is returned (e.g. invalid or missing title). if ( !isset( $response['query']['pages'] ) - || isset( $response['query']['pages'][0]['missing'] ) - || isset( $response['query']['pages'][0]['invalid'] ) + || !isset( $response['query']['pages'][0]['imageinfo'][0] ) ) { return null; }