1
0
Fork 0
mirror of synced 2024-07-06 07:00:56 +12:00

chore: update checks

This commit is contained in:
Christy Jacob 2024-03-18 12:41:51 +00:00
parent a306cb87d8
commit 5e6c94d307

View file

@ -285,10 +285,14 @@ App::get('/v1/avatars/image')
}
$client = new Client();
$res = $client
try {
$res = $client
->setAllowRedirects(false)
->fetch($url);
} catch (\Throwable) {
throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED);
}
if ($res->getStatusCode() !== 200) {
throw new Exception(Exception::AVATAR_IMAGE_NOT_FOUND);
}
@ -344,7 +348,8 @@ App::get('/v1/avatars/favicon')
}
$client = new Client();
$res = $client
try {
$res = $client
->setAllowRedirects(false)
->setUserAgent(\sprintf(
APP_USERAGENT,
@ -352,7 +357,10 @@ App::get('/v1/avatars/favicon')
App::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY)
))
->fetch($url);
} catch (\Throwable) {
throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED);
}
if ($res->getStatusCode() !== 200) {
throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED);
}
@ -415,9 +423,13 @@ App::get('/v1/avatars/favicon')
}
$client = new Client();
$res = $client
->setAllowRedirects(false)
->fetch($outputHref);
try {
$res = $client
->setAllowRedirects(false)
->fetch($outputHref);
} catch (\Throwable) {
throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED);
}
if ($res->getStatusCode() !== 200) {
throw new Exception(Exception::AVATAR_ICON_NOT_FOUND);