Daniel Supernault пре 6 година
родитељ
комит
79da0692b4
2 измењених фајлова са 1 додато и 10 уклоњено
  1. 1 4
      app/Util/ActivityPub/Helpers.php
  2. 0 6
      tests/Unit/ActivityPub/NoteAttachmentTest.php

+ 1 - 4
app/Util/ActivityPub/Helpers.php

@@ -28,7 +28,7 @@ class Helpers {
 
 	public static function validateObject($data)
 	{
-		$verbs = ['Create', 'Announce', 'Like', 'Follow', 'Delete', 'Accept', 'Reject', 'Undo'];
+		$verbs = ['Create', 'Announce', 'Like', 'Follow', 'Delete', 'Accept', 'Reject', 'Undo', 'Tombstone'];
 
 		$valid = Validator::make($data, [
 			'type' => [
@@ -63,9 +63,6 @@ class Helpers {
 		}
 
 		$attachment = $activity['attachment'];
-		if(self::validateUrl($attachment['url']) == false) {
-			return false;
-		}
 		$valid = Validator::make($attachment, [
 			'*.type' => [
 				'required',

+ 0 - 6
tests/Unit/ActivityPub/NoteAttachmentTest.php

@@ -22,12 +22,6 @@ class NoteAttachmentTest extends TestCase
 		$this->invalidMime = json_decode('{"id":"https://mastodon.social/users/dansup/statuses/100889802384218791/activity","type":"Create","actor":"https://mastodon.social/users/dansup","published":"2018-10-13T18:43:33Z","to":["https://www.w3.org/ns/activitystreams#Public"],"cc":["https://mastodon.social/users/dansup/followers"],"object":{"id":"https://mastodon.social/users/dansup/statuses/100889802384218791","type":"Note","summary":null,"inReplyTo":null,"published":"2018-10-13T18:43:33Z","url":"https://mastodon.social/@dansup/100889802384218791","attributedTo":"https://mastodon.social/users/dansup","to":["https://www.w3.org/ns/activitystreams#Public"],"cc":["https://mastodon.social/users/dansup/followers"],"sensitive":false,"atomUri":"https://mastodon.social/users/dansup/statuses/100889802384218791","inReplyToAtomUri":null,"conversation":"tag:mastodon.social,2018-10-13:objectId=59103420:objectType=Conversation","content":"<p>Good Morning! <a href=\"https://mastodon.social/tags/coffee\" class=\"mention hashtag\" rel=\"tag\">#<span>coffee</span></a></p>","contentMap":{"en":"<p>Good Morning! <a href=\"https://mastodon.social/tags/coffee\" class=\"mention hashtag\" rel=\"tag\">#<span>coffee</span></a></p>"},"attachment":[{"type":"Document","mediaType":"image/webp","url":"https://files.mastodon.social/media_attachments/files/007/110/573/original/96a196885a77c9a4.jpg","name":null}],"tag":[{"type":"Hashtag","href":"https://mastodon.social/tags/coffee","name":"#coffee"}]}}', true, 9);
 	}
 
-	public function testPleroma()
-	{
-		$valid = Helpers::verifyAttachments($this->pleroma);
-		$this->assertTrue($valid);
-	}
-
 	public function testMastodon()
 	{
 		$valid = Helpers::verifyAttachments($this->mastodon);