Skip to content

Commit

Permalink
Check for imageinfo rather than missing or invalid
Browse files Browse the repository at this point in the history
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
  • Loading branch information
samwilson authored Aug 20, 2024
1 parent aadedad commit f4ddb4e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/BookProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f4ddb4e

Please sign in to comment.