uploaded media plug: do not inject compile-time params on every request
authorrinpatch <rinpatch@sdf.org>
Fri, 13 Mar 2020 19:12:33 +0000 (22:12 +0300)
committerrinpatch <rinpatch@sdf.org>
Fri, 13 Mar 2020 19:12:33 +0000 (22:12 +0300)
lib/pleroma/plugs/uploaded_media.ex

index 74427709d8af65ddbc1df7757131f866e3188ccc..36ff024a7d6e562e2f90c0bf0025a373cd725e04 100644 (file)
@@ -18,7 +18,10 @@ defmodule Pleroma.Plugs.UploadedMedia do
 
   def init(_opts) do
     static_plug_opts =
-      []
+      [
+        headers: %{"cache-control" => @default_cache_control_header},
+        cache_control_for_etags: @default_cache_control_header
+      ]
       |> Keyword.put(:from, "__unconfigured_media_plug")
       |> Keyword.put(:at, "/__unconfigured_media_plug")
       |> Plug.Static.init()
@@ -60,10 +63,6 @@ defmodule Pleroma.Plugs.UploadedMedia do
       Map.get(opts, :static_plug_opts)
       |> Map.put(:at, [@path])
       |> Map.put(:from, directory)
-      |> Map.put(:cache_control_for_etags, @default_cache_control_header)
-      |> Map.put(:headers, %{
-        "cache-control" => @default_cache_control_header
-      })
 
     conn = Plug.Static.call(conn, static_opts)