Move Content-Type check before JSON decode in ActivityPub\Processor::fetchMissingActivity

This commit is contained in:
Hypolite Petovan 2024-03-06 18:18:26 -05:00
parent 54852ecb56
commit 6ab43439f4
1 changed files with 5 additions and 5 deletions

View File

@ -1603,6 +1603,11 @@ class Processor
return '';
}
if (!HTTPSignature::isValidContentType($curlResult->getContentType())) {
Logger::notice('Unexpected content type', ['content-type' => $curlResult->getContentType(), 'url' => $url]);
return '';
}
$object = json_decode($body, true);
if (!empty($object)) {
@ -1618,11 +1623,6 @@ class Processor
return '';
}
if (!HTTPSignature::isValidContentType($curlResult->getContentType())) {
Logger::notice('Unexpected content type', ['content-type' => $curlResult->getContentType(), 'url' => $url]);
return '';
}
$ldobject = JsonLD::compact($object);
$signer = [];