From 05737a46fb612634f7ce1a1b89c8c6facd686dd6 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 28 Feb 2020 14:52:29 +0100 Subject: [PATCH] Improve funding info parsing --- src/Composer/Repository/Vcs/GitHubDriver.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index 8194b196d..2fe7e872e 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -205,6 +205,7 @@ class GitHubDriver extends VcsDriver if (empty($response['content']) || $response['encoding'] !== 'base64' || !($funding = base64_decode($response['content']))) { continue; } + break; } if (empty($funding)) { return $this->fundingInfo = false; @@ -218,16 +219,16 @@ class GitHubDriver extends VcsDriver if (preg_match('{^(\w+)\s*:\s*(.+)$}', $line, $match)) { if (preg_match('{^\[.*\]$}', $match[2])) { foreach (array_map('trim', preg_split('{[\'"]?\s*,\s*[\'"]?}', substr($match[2], 1, -1))) as $item) { - $result[] = array('type' => $match[1], 'url' => trim($item, '"\'')); + $result[] = array('type' => $match[1], 'url' => trim($item, '"\' ')); } } else { - $result[] = array('type' => $match[1], 'url' => $match[2]); + $result[] = array('type' => $match[1], 'url' => trim($match[2], '"\' ')); } $key = null; } elseif (preg_match('{^(\w+)\s*:$}', $line, $match)) { $key = $match[1]; } elseif ($key && preg_match('{^-\s*(.+)$}', $line, $match)) { - $result[] = array('type' => $key, 'url' => $match[1]); + $result[] = array('type' => $key, 'url' => trim($match[1], '"\' ')); } }