Skip to content

Commit cbe4c6f

Browse files
authored
Add link to rate-limit discussion in rate-limit error (#181)
1 parent 8decb9d commit cbe4c6f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/card.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,11 @@ function convertSvgToPng(string $svg): string
307307
$svg = trim($svg);
308308

309309
// remove style and animations
310-
$svg = preg_replace('/(<style>\X*<\/style>)/m', '', $svg);
310+
$svg = preg_replace('/(<style>\X*?<\/style>)/m', '', $svg);
311311
$svg = preg_replace('/(opacity: 0;)/m', 'opacity: 1;', $svg);
312312
$svg = preg_replace('/(animation: fadein.*?;)/m', 'opacity: 1;', $svg);
313313
$svg = preg_replace('/(animation: currentstreak.*?;)/m', 'font-size: 28px;', $svg);
314+
$svg = preg_replace('/<a href\X*?>(\X*?)<\/a>/m', '\1', $svg);
314315

315316
// create canvas
316317
$imagick = new Imagick();

src/stats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function getContributionDates(array $contributionGraphs): array
6767
foreach ($contributionGraphs as $graph) {
6868
// if HTML contains "Please wait", we are being rate-limited
6969
if (strpos($graph, "Please wait") !== false) {
70-
throw new AssertionError("Oh no! We are being rate-limited!");
70+
throw new AssertionError("We are being rate-limited! Check <a href='https://git.io/streak-ratelimit' font-weight='bold'>git.io/streak-ratelimit</a> for details.");
7171
}
7272
// split into lines
7373
$lines = explode("\n", $graph);

0 commit comments

Comments
 (0)