mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[bugfix] add stricter checks during all stages of dereferencing remote AS objects (#2639)
* add stricter checks during all stages of dereferencing remote AS objects * a comment
This commit is contained in:
@@ -154,71 +154,3 @@ func (suite *FederatingActorTestSuite) TestSendRemoteFollower() {
|
||||
func TestFederatingActorTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(FederatingActorTestSuite))
|
||||
}
|
||||
|
||||
func TestIsASMediaType(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
Input string
|
||||
Expect bool
|
||||
}{
|
||||
{
|
||||
Input: "application/activity+json",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/activity+json; charset=utf-8",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/activity+json;charset=utf-8",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/activity+json ;charset=utf-8",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/activity+json ; charset=utf-8",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/ld+json;profile=https://www.w3.org/ns/activitystreams",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/ld+json;profile=\"https://www.w3.org/ns/activitystreams\"",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/ld+json ;profile=https://www.w3.org/ns/activitystreams",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/ld+json ;profile=\"https://www.w3.org/ns/activitystreams\"",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/ld+json ; profile=https://www.w3.org/ns/activitystreams",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/ld+json ; profile=\"https://www.w3.org/ns/activitystreams\"",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/ld+json; profile=https://www.w3.org/ns/activitystreams",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"",
|
||||
Expect: true,
|
||||
},
|
||||
{
|
||||
Input: "application/ld+json",
|
||||
Expect: false,
|
||||
},
|
||||
} {
|
||||
if federation.IsASMediaType(test.Input) != test.Expect {
|
||||
t.Errorf("did not get expected result %v for input: %s", test.Expect, test.Input)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user