forked from YokaiRick/akkoma
UploadedMedia: Add missing disposition_type to Content-Disposition
Set it to `inline` because the vast majority of what's sent is multimedia content while `attachment` would have the side-effect of triggering a download dialog. Closes: https://git.pleroma.social/pleroma/pleroma/-/issues/3114
This commit is contained in:
parent
1def80c2e7
commit
37b0d774fa
2 changed files with 3 additions and 3 deletions
|
@ -37,7 +37,7 @@ def call(%{request_path: <<"/", @path, "/", file::binary>>} = conn, opts) do
|
||||||
%{query_params: %{"name" => name}} = conn ->
|
%{query_params: %{"name" => name}} = conn ->
|
||||||
name = escape_header_value(name)
|
name = escape_header_value(name)
|
||||||
|
|
||||||
put_resp_header(conn, "content-disposition", "filename=\"#{name}\"")
|
put_resp_header(conn, "content-disposition", "inline; filename=\"#{name}\"")
|
||||||
|
|
||||||
conn ->
|
conn ->
|
||||||
conn
|
conn
|
||||||
|
|
|
@ -37,7 +37,7 @@ test "sends Content-Disposition header when name param is set", %{
|
||||||
|
|
||||||
assert Enum.any?(
|
assert Enum.any?(
|
||||||
conn.resp_headers,
|
conn.resp_headers,
|
||||||
&(&1 == {"content-disposition", "filename=\"\\\"cofe\\\".gif\""})
|
&(&1 == {"content-disposition", "inline; filename=\"\\\"cofe\\\".gif\""})
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ test "removes control characters from the Content-Disposition header", %{
|
||||||
|
|
||||||
assert Enum.any?(
|
assert Enum.any?(
|
||||||
conn.resp_headers,
|
conn.resp_headers,
|
||||||
&(&1 == {"content-disposition", "filename=\"\\\"cofe\\\".gif\""})
|
&(&1 == {"content-disposition", ~s[inline; filename="\\"cofe\\".gif"]})
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue