chore: update checks
This commit is contained in:
parent
a306cb87d8
commit
5e6c94d307
1 changed files with 19 additions and 7 deletions
|
@ -285,9 +285,13 @@ App::get('/v1/avatars/image')
|
||||||
}
|
}
|
||||||
|
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
$res = $client
|
try {
|
||||||
|
$res = $client
|
||||||
->setAllowRedirects(false)
|
->setAllowRedirects(false)
|
||||||
->fetch($url);
|
->fetch($url);
|
||||||
|
} catch (\Throwable) {
|
||||||
|
throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
if ($res->getStatusCode() !== 200) {
|
if ($res->getStatusCode() !== 200) {
|
||||||
throw new Exception(Exception::AVATAR_IMAGE_NOT_FOUND);
|
throw new Exception(Exception::AVATAR_IMAGE_NOT_FOUND);
|
||||||
|
@ -344,7 +348,8 @@ App::get('/v1/avatars/favicon')
|
||||||
}
|
}
|
||||||
|
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
$res = $client
|
try {
|
||||||
|
$res = $client
|
||||||
->setAllowRedirects(false)
|
->setAllowRedirects(false)
|
||||||
->setUserAgent(\sprintf(
|
->setUserAgent(\sprintf(
|
||||||
APP_USERAGENT,
|
APP_USERAGENT,
|
||||||
|
@ -352,6 +357,9 @@ App::get('/v1/avatars/favicon')
|
||||||
App::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY)
|
App::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY)
|
||||||
))
|
))
|
||||||
->fetch($url);
|
->fetch($url);
|
||||||
|
} catch (\Throwable) {
|
||||||
|
throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
if ($res->getStatusCode() !== 200) {
|
if ($res->getStatusCode() !== 200) {
|
||||||
throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED);
|
throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED);
|
||||||
|
@ -415,9 +423,13 @@ App::get('/v1/avatars/favicon')
|
||||||
}
|
}
|
||||||
|
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
$res = $client
|
try {
|
||||||
->setAllowRedirects(false)
|
$res = $client
|
||||||
->fetch($outputHref);
|
->setAllowRedirects(false)
|
||||||
|
->fetch($outputHref);
|
||||||
|
} catch (\Throwable) {
|
||||||
|
throw new Exception(Exception::AVATAR_REMOTE_URL_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
if ($res->getStatusCode() !== 200) {
|
if ($res->getStatusCode() !== 200) {
|
||||||
throw new Exception(Exception::AVATAR_ICON_NOT_FOUND);
|
throw new Exception(Exception::AVATAR_ICON_NOT_FOUND);
|
||||||
|
|
Loading…
Reference in a new issue