mirror of
https://github.com/friendica/friendica
synced 2024-11-18 00:23:47 +00:00
Merge pull request #14482 from annando/issue-14126
Issue 14126: Workaround for wrong content types
This commit is contained in:
commit
04cb2c43e3
1 changed files with 4 additions and 0 deletions
|
@ -4155,6 +4155,10 @@ class Item
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$curlResult = DI::httpClient()->head($uri, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::JSON_AS, HttpClientOptions::REQUEST => HttpClientRequest::ACTIVITYPUB]);
|
$curlResult = DI::httpClient()->head($uri, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::JSON_AS, HttpClientOptions::REQUEST => HttpClientRequest::ACTIVITYPUB]);
|
||||||
|
if (!HTTPSignature::isValidContentType($curlResult->getContentType(), $uri) && (current(explode(';', $curlResult->getContentType())) == 'application/json')) {
|
||||||
|
// Issue 14126: Workaround for Mastodon servers that return "application/json" on a "head" request.
|
||||||
|
$curlResult = HTTPSignature::fetchRaw($uri, $uid);
|
||||||
|
}
|
||||||
if (HTTPSignature::isValidContentType($curlResult->getContentType(), $uri)) {
|
if (HTTPSignature::isValidContentType($curlResult->getContentType(), $uri)) {
|
||||||
$fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri, [], '', $completion, $uid);
|
$fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri, [], '', $completion, $uid);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue