Merge pull request #6417 from pixelfed/shleeable-patch-16

Safety: Update BouncerService.php to fallback to empty array instead of crashing on failed fetch
pull/6441/head
dansup 3 weeks ago committed by GitHub
commit e859972848
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -13,7 +13,17 @@ class BouncerService
$knownCloudCidrs = Cache::rememberForever('pf:bouncer-service:check-ip:known-cloud-cidrs', function () {
$file = Storage::get('bouncer/all.json');
return json_decode($file, true);
if ($file === null) {
return [];
}
$decoded = json_decode($file, true);
if ($decoded === null || !is_array($decoded)) {
return [];
}
return $decoded;
});
return IpUtils::checkIp($ip, $knownCloudCidrs);

Loading…
Cancel
Save