Skip to content

Commit

Permalink
minor #834 Hit raw.githubusercontent.com to work around rate limiting…
Browse files Browse the repository at this point in the history
… (nicolas-grekas)

This PR was merged into the 1.x branch.

Discussion
----------

Hit raw.githubusercontent.com to work around rate limiting

Commits
-------

2bc9f00 Hit raw.githubusercontent.com to work around rate limiting
  • Loading branch information
nicolas-grekas committed Nov 23, 2021
2 parents acd0b50 + 2bc9f00 commit 4345d08
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 4345d08

Please sign in to comment.