Merge branch 'tusooa/3154-attachment-type-check' into 'develop'
Restrict attachments to only uploaded files only Closes #3154 See merge request pleroma/pleroma!3923
This commit is contained in:
commit
819fccb7d1
4 changed files with 17 additions and 4 deletions
|
|
@ -592,7 +592,7 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
|
|||
end
|
||||
|
||||
test "returns list attachments with desc" do
|
||||
object = insert(:note)
|
||||
object = insert(:attachment)
|
||||
desc = Jason.encode!(%{object.id => "test-desc"})
|
||||
|
||||
assert Utils.attachments_from_ids_descs(["#{object.id}", "34"], desc) == [
|
||||
|
|
@ -603,7 +603,7 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
|
|||
|
||||
describe "attachments_from_ids/1" do
|
||||
test "returns attachments with descs" do
|
||||
object = insert(:note)
|
||||
object = insert(:attachment)
|
||||
desc = Jason.encode!(%{object.id => "test-desc"})
|
||||
|
||||
assert Utils.attachments_from_ids(%{
|
||||
|
|
@ -615,13 +615,18 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
|
|||
end
|
||||
|
||||
test "returns attachments without descs" do
|
||||
object = insert(:note)
|
||||
object = insert(:attachment)
|
||||
assert Utils.attachments_from_ids(%{media_ids: ["#{object.id}"]}) == [object.data]
|
||||
end
|
||||
|
||||
test "returns [] when not pass media_ids" do
|
||||
assert Utils.attachments_from_ids(%{}) == []
|
||||
end
|
||||
|
||||
test "checks that the object is of upload type" do
|
||||
object = insert(:note)
|
||||
assert Utils.attachments_from_ids(%{media_ids: ["#{object.id}"]}) == []
|
||||
end
|
||||
end
|
||||
|
||||
describe "maybe_add_list_data/3" do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue