[ActivityPub] attributedTo itself is not required, if not present then it should be inferred from the actor
Reported by kaniini
This commit is contained in:
parent
b7ce5b91a4
commit
4133874e59
|
@ -142,7 +142,13 @@ class Activitypub_notice
|
||||||
|
|
||||||
// Ensure Actor Profile
|
// Ensure Actor Profile
|
||||||
if (is_null($actor_profile)) {
|
if (is_null($actor_profile)) {
|
||||||
$actor_profile = ActivityPub_explorer::get_profile_from_url($object['attributedTo']);
|
if (isset($object['attributedTo'])) {
|
||||||
|
$actor_profile = ActivityPub_explorer::get_profile_from_url($object['attributedTo']);
|
||||||
|
} elseif (isset($object['actor'])) {
|
||||||
|
$actor_profile = ActivityPub_explorer::get_profile_from_url($object['actor']);
|
||||||
|
} else {
|
||||||
|
throw new Exception("A notice can't be created without an actor.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$act = new Activity();
|
$act = new Activity();
|
||||||
|
@ -234,10 +240,6 @@ class Activitypub_notice
|
||||||
*/
|
*/
|
||||||
public static function validate_note($object)
|
public static function validate_note($object)
|
||||||
{
|
{
|
||||||
if (!isset($object['attributedTo'])) {
|
|
||||||
common_debug('ActivityPub Notice Validator: Rejected because attributedTo was not specified.');
|
|
||||||
throw new Exception('No attributedTo specified.');
|
|
||||||
}
|
|
||||||
if (!isset($object['id'])) {
|
if (!isset($object['id'])) {
|
||||||
common_debug('ActivityPub Notice Validator: Rejected because Object ID was not specified.');
|
common_debug('ActivityPub Notice Validator: Rejected because Object ID was not specified.');
|
||||||
throw new Exception('Object ID not specified.');
|
throw new Exception('Object ID not specified.');
|
||||||
|
@ -250,7 +252,7 @@ class Activitypub_notice
|
||||||
throw new Exception('Invalid Object type.');
|
throw new Exception('Invalid Object type.');
|
||||||
}
|
}
|
||||||
if (!isset($object['content'])) {
|
if (!isset($object['content'])) {
|
||||||
common_debug('ActivityPub Notice Validator: Rejected because Content was not specified.');
|
common_debug('ActivityPub Notice Validator: Rejected because Content was not specified (GNU social requires content in notes).');
|
||||||
throw new Exception('Object content was not specified.');
|
throw new Exception('Object content was not specified.');
|
||||||
}
|
}
|
||||||
if (isset($object['url']) && !filter_var($object['url'], FILTER_VALIDATE_URL)) {
|
if (isset($object['url']) && !filter_var($object['url'], FILTER_VALIDATE_URL)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user