mirror of
https://github.com/friendica/friendica
synced 2025-05-05 17:04:11 +02:00
Merge pull request #13921 from annando/content-type
Check for activity pub mime types
This commit is contained in:
commit
bb7d25dfc9
3 changed files with 24 additions and 5 deletions
|
@ -443,9 +443,25 @@ class HTTPSignature
|
|||
return [];
|
||||
}
|
||||
|
||||
if (!self::isValidContentType($curlResult->getContentType())) {
|
||||
Logger::notice('Unexpected content type', ['content-type' => $curlResult->getContentType(), 'url' => $request]);
|
||||
return [];
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the provided content type is a valid LD JSON mime type
|
||||
*
|
||||
* @param string $contentType
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isValidContentType(string $contentType): bool
|
||||
{
|
||||
return in_array(current(explode(';', $contentType)), ['application/activity+json', 'application/ld+json']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches raw data for a user
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue