Skip to content

Commit

Permalink
Fixed json api fetch when using bookmark urls
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Sep 28, 2023
1 parent 6ed875c commit 5d652a3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Plugin/migrate_plus/data_parser/LocalistJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ protected static function getPagedUrls(string $url): array {
$results = json_decode((string) \Drupal::httpClient()
->request('GET', "$base_url?$query")
->getBody(), TRUE, 512, JSON_THROW_ON_ERROR);

if (!isset($results['page']['total'])) {
throw new \Exception('No Pager');
}
}
catch (\Throwable $e) {
// In case something errors, just return the original url.
return [$url];
}

$total_count = $results['page']['total'];

$paged_urls = [];
Expand Down

0 comments on commit 5d652a3

Please sign in to comment.