Lemmy support added

This commit is contained in:
Michael 2022-01-22 15:24:51 +00:00
parent 732663ea6b
commit 43b9e39c6a
2 changed files with 47 additions and 1 deletions

View file

@ -60,6 +60,12 @@ class ParseUrl
public static function getContentType(string $url)
{
$curlResult = DI::httpClient()->head($url);
// Workaround for systems that can't handle a HEAD request
if (!$curlResult->isSuccess() && ($curlResult->getReturnCode() == 405)) {
$curlResult = DI::httpClient()->get($url, [HttpClientOptions::CONTENT_LENGTH => 1000000]);
}
if (!$curlResult->isSuccess()) {
return [];
}