diff --git a/mirror.php b/mirror.php index 4fb66e2..364ef39 100755 --- a/mirror.php +++ b/mirror.php @@ -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));