Some more "accept" parameters are added
This commit is contained in:
parent
173e72169b
commit
1fae0123ec
32 changed files with 111 additions and 60 deletions
|
@ -22,8 +22,10 @@
|
|||
namespace Friendica\Core\Storage\Type;
|
||||
|
||||
use Exception;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Storage\Exception\ReferenceStorageException;
|
||||
use Friendica\Core\Storage\Capability\ICanReadFromStorage;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClient;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
|
||||
/**
|
||||
|
@ -52,11 +54,12 @@ class ExternalResource implements ICanReadFromStorage
|
|||
}
|
||||
|
||||
try {
|
||||
$fetchResult = HTTPSignature::fetchRaw($data->url, $data->uid, ['accept_content' => []]);
|
||||
$fetchResult = HTTPSignature::fetchRaw($data->url, $data->uid, ['accept_content' => [HttpClient::ACCEPT_IMAGE]]);
|
||||
} catch (Exception $exception) {
|
||||
throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference), $exception->getCode(), $exception);
|
||||
}
|
||||
if ($fetchResult->isSuccess()) {
|
||||
Logger::debug('Got picture', ['Content-Type' => $fetchResult->getHeader('Content-Type'), 'uid' => $data->uid, 'url' => $data->url]);
|
||||
return $fetchResult->getBody();
|
||||
} else {
|
||||
throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference), $fetchResult->getReturnCode(), new Exception($fetchResult->getBody()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue