Skip to content

Commit

Permalink
Fix type of preg_match result
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Nov 21, 2024
1 parent 60251f6 commit 59058ff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mirror.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,9 @@ private function downloadV2Files(array $requests): bool
}

// check the response is for the correct package as safety check against corruption
preg_match('{^/p2/(.+?)(~dev)?.json$}', $userData['path'], $match);
if (!preg_match('{^/p2/(.+?)(~dev)?.json$}', $userData['path'], $match)) {
throw new \Exception('Invalid path could not be parsed: '.$userData['path']);
}
$packageName = $match[1];
if (!isset($decoded['packages'][$packageName])) {
throw new \Exception('Invalid response for file '.$userData['path'].', '.$packageName.' could not be found in file content: '.substr($metadata, 0, 300));
Expand Down

0 comments on commit 59058ff

Please sign in to comment.