Fix MediaProxy Invalidation for Http method

This commit is contained in:
Mark Felder 2020-05-22 13:53:03 -05:00
parent 72189d227f
commit aa06fc584b
3 changed files with 15 additions and 5 deletions

View File

@ -405,6 +405,14 @@ config :pleroma, :media_proxy,
],
whitelist: []
config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Http, %{
"method" => :purge,
"headers" => [],
"options" => []
}
config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script, script_path: nil
config :pleroma, :chat, enabled: true
config :phoenix, :format_encoders, json: Jason

View File

@ -283,10 +283,11 @@ This strategy allow perform custom http request to purge cache.
Example:
```elixir
config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Http,
method: :purge,
headers: [],
options: []
config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Http, %{
"method" => :purge,
"headers" => [],
"options" => []
}
```
## Link previews

View File

@ -17,7 +17,8 @@ defmodule Pleroma.Web.MediaProxy.Invalidation.Http do
Logger.debug("Running cache purge: #{inspect(urls)}")
Enum.each(urls, fn url ->
with {:error, error} <- do_purge(method, url, headers, options) do
with {:error, error} <-
do_purge(method, url |> Pleroma.Web.MediaProxy.url(), headers, options) do
Logger.error("Error while cache purge: url - #{url}, error: #{inspect(error)}")
end
end)