Merge remote-tracking branch 'upstream/stable' into mergeback/2.5.1

This commit is contained in:
tusooa 2023-03-01 20:09:50 -05:00
commit f33401f54b
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
75 changed files with 147 additions and 75 deletions

View file

@ -1342,6 +1342,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
%{test_file: test_file}
end
test "strips / from filename", %{test_file: file} do
file = %Plug.Upload{file | filename: "../../../../../nested/bad.jpg"}
{:ok, %Object{} = object} = ActivityPub.upload(file)
[%{"href" => href}] = object.data["url"]
assert Regex.match?(~r"/bad.jpg$", href)
refute Regex.match?(~r"/nested/", href)
end
test "sets a description if given", %{test_file: file} do
{:ok, %Object{} = object} = ActivityPub.upload(file, description: "a cool file")
assert object.data["name"] == "a cool file"