Skip to content

Commit a083871

Browse files
committed
[#352] Check if there is a link to follow
Signed-off-by: Roland Dalmulder <contact@rolandd.com>
1 parent f250b56 commit a083871

File tree

1 file changed

+6
-1
lines changed
  • administrator/components/com_patchtester/PatchTester/Model

1 file changed

+6
-1
lines changed

administrator/components/com_patchtester/PatchTester/Model/PullModel.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,15 @@ private function getFiles(int $id, int $page, array $files = []): array
564564
$filesResponse = $github->getFilesForPullRequest($this->getState()->get('github_user'), $this->getState()->get('github_repo'), $id, $page);
565565
$files = array_merge($files, json_decode($filesResponse->getBody(), false));
566566
$lastPage = 1;
567+
$headers = $filesResponse->getHeaders();
568+
569+
if (!isset($headers['link'])) {
570+
return $files;
571+
}
567572

568573
preg_match(
569574
'/(\?page=[0-9]{1,3}>; rel=\"last\")/',
570-
$filesResponse->getHeaders()['link'][0],
575+
$headers['link'][0],
571576
$matches
572577
);
573578
if ($matches && isset($matches[0])) {

0 commit comments

Comments
 (0)