summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2023-04-17 21:07:08 +0200
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2023-04-18 00:09:19 +0200
commit8f0f58e28b58cd9a4a05f1b927aa24fd63f9a3bd (patch)
tree7f8e75e9b8adb07d80696319f150b2c9239c9030
parent3867b52aefdab5c26bcd4f58155b1370ee40e4dd (diff)
downloadpleroma-8f0f58e28b58cd9a4a05f1b927aa24fd63f9a3bd.tar.gz
pleroma-8f0f58e28b58cd9a4a05f1b927aa24fd63f9a3bd.zip
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
-rw-r--r--changelog.d/3873.fix1
-rw-r--r--lib/pleroma/web/plugs/uploaded_media.ex2
-rw-r--r--test/pleroma/web/plugs/uploaded_media_plug_test.exs2
3 files changed, 3 insertions, 2 deletions
diff --git a/changelog.d/3873.fix b/changelog.d/3873.fix
new file mode 100644
index 000000000..4699f7b58
--- /dev/null
+++ b/changelog.d/3873.fix
@@ -0,0 +1 @@
+UploadedMedia: Add missing disposition_type to Content-Disposition \ No newline at end of file
diff --git a/lib/pleroma/web/plugs/uploaded_media.ex b/lib/pleroma/web/plugs/uploaded_media.ex
index ad8143234..71d8f2f74 100644
--- a/lib/pleroma/web/plugs/uploaded_media.ex
+++ b/lib/pleroma/web/plugs/uploaded_media.ex
@@ -37,7 +37,7 @@ defmodule Pleroma.Web.Plugs.UploadedMedia do
%{query_params: %{"name" => name}} = conn ->
name = String.replace(name, "\"", "\\\"")
- put_resp_header(conn, "content-disposition", "filename=\"#{name}\"")
+ put_resp_header(conn, "content-disposition", "inline; filename=\"#{name}\"")
conn ->
conn
diff --git a/test/pleroma/web/plugs/uploaded_media_plug_test.exs b/test/pleroma/web/plugs/uploaded_media_plug_test.exs
index ec46b0537..99ba49d37 100644
--- a/test/pleroma/web/plugs/uploaded_media_plug_test.exs
+++ b/test/pleroma/web/plugs/uploaded_media_plug_test.exs
@@ -37,7 +37,7 @@ defmodule Pleroma.Web.Plugs.UploadedMediaPlugTest do
assert Enum.any?(
conn.resp_headers,
- &(&1 == {"content-disposition", "filename=\"\\\"cofe\\\".gif\""})
+ &(&1 == {"content-disposition", "inline; filename=\"\\\"cofe\\\".gif\""})
)
end
end