[#352] Check if there is a link to follow

Signed-off-by: Roland Dalmulder <contact@rolandd.com>
This commit is contained in:
Roland Dalmulder 2023-05-12 15:13:46 +02:00
parent f250b56718
commit a083871234
No known key found for this signature in database
GPG Key ID: 6D30CD38749A5B9E
1 changed files with 6 additions and 1 deletions

View File

@ -564,10 +564,15 @@ class PullModel extends AbstractModel
$filesResponse = $github->getFilesForPullRequest($this->getState()->get('github_user'), $this->getState()->get('github_repo'), $id, $page);
$files = array_merge($files, json_decode($filesResponse->getBody(), false));
$lastPage = 1;
$headers = $filesResponse->getHeaders();
if (!isset($headers['link'])) {
return $files;
}
preg_match(
'/(\?page=[0-9]{1,3}>; rel=\"last\")/',
$filesResponse->getHeaders()['link'][0],
$headers['link'][0],
$matches
);
if ($matches && isset($matches[0])) {