static/gravatar: Don't respond with a 500 in case of a connection error

This commit is contained in:
Johannes Meyer 2019-04-23 10:04:33 +02:00
parent 0be1053197
commit 57abdc8baa
1 changed files with 5 additions and 1 deletions

View File

@ -52,7 +52,11 @@ class StaticController extends Controller
return;
}
$img = file_get_contents('http://www.gravatar.com/avatar/' . $filename . '?s=120&d=mm');
$img = @file_get_contents('http://www.gravatar.com/avatar/' . $filename . '?s=120&d=mm');
if ($img === false) {
$this->httpNotFound('Unable to connect to gravatar.com');
}
$cache->store($cacheFile, $img);
$response->setHeader('ETag', sprintf('"%s"', $cache->etagForCachedFile($cacheFile)));