Skip to content

Commit

Permalink
Hit raw.githubusercontent.com to work around rate limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Nov 23, 2021
1 parent acd0b50 commit 2bc9f00
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Downloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
class Downloader
{
private const DEFAULT_ENDPOINTS = [
'https://api.github.com/repos/symfony/recipes/contents/index.json?ref=flex/main',
'https://api.github.com/repos/symfony/recipes-contrib/contents/index.json?ref=flex/main',
'https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json',
'https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json',
];
private const MAX_LENGTH = 1000;

Expand Down Expand Up @@ -416,6 +416,7 @@ private function initialize()
private static function generateCacheKey(string $url): string
{
$url = preg_replace('{^https://api.github.com/repos/([^/]++/[^/]++)/contents/}', '$1/', $url);
$url = preg_replace('{^https://raw.githubusercontent.com/([^/]++/[^/]++)/}', '$1/', $url);

return preg_replace('{[^a-z0-9.]}i', '-', $url);
}
Expand Down

0 comments on commit 2bc9f00

Please sign in to comment.