mirror of
https://github.com/friendica/friendica
synced 2025-04-26 10:30:11 +00:00
Improved support for "Page" type
This commit is contained in:
parent
9d25c3a8f6
commit
9eec2bf5f3
3 changed files with 15 additions and 1 deletions
|
@ -169,6 +169,12 @@ class Media
|
|||
if (empty($media['mimetype']) || empty($media['size'])) {
|
||||
$timeout = DI::config()->get('system', 'xrd_timeout');
|
||||
$curlResult = DI::httpClient()->head($media['url'], [HttpClientOptions::TIMEOUT => $timeout]);
|
||||
|
||||
// Workaround for systems that can't handle a HEAD request
|
||||
if (!$curlResult->isSuccess() && ($curlResult->getReturnCode() == 405)) {
|
||||
$curlResult = DI::httpClient()->get($media['url'], [HttpClientOptions::TIMEOUT => $timeout]);
|
||||
}
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
if (empty($media['mimetype'])) {
|
||||
$media['mimetype'] = $curlResult->getHeader('Content-Type')[0] ?? '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue