Check for activity pub mime types
This commit is contained in:
@@ -1610,11 +1610,6 @@ class Processor
|
||||
}
|
||||
|
||||
if (empty($object) || !is_array($object)) {
|
||||
$element = explode(';', $curlResult->getContentType());
|
||||
if (!in_array($element[0], ['application/activity+json', 'application/ld+json', 'application/json'])) {
|
||||
Logger::debug('Unexpected content-type', ['url' => $url, 'content-type' => $curlResult->getContentType()]);
|
||||
return null;
|
||||
}
|
||||
Logger::notice('Invalid JSON data', ['url' => $url, 'content-type' => $curlResult->getContentType(), 'body' => $body]);
|
||||
return '';
|
||||
}
|
||||
@@ -1623,6 +1618,11 @@ 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 = [];
|
||||
|
||||
Reference in New Issue
Block a user