rename function

This commit is contained in:
Mark Felder 2021-01-21 14:41:28 -06:00
parent 003402df40
commit e5b32aab92

View file

@ -13,7 +13,7 @@ defmodule Pleroma.Web.MediaProxy.Invalidation.Script do
def purge(urls, opts \\ []) do def purge(urls, opts \\ []) do
args = args =
urls urls
|> format_urls(Keyword.get(opts, :url_format)) |> maybe_format_urls(Keyword.get(opts, :url_format))
|> List.wrap() |> List.wrap()
|> Enum.uniq() |> Enum.uniq()
|> Enum.join(" ") |> Enum.join(" ")
@ -42,7 +42,7 @@ defmodule Pleroma.Web.MediaProxy.Invalidation.Script do
{:error, inspect(error)} {:error, inspect(error)}
end end
def format_urls(urls, :htcacheclean) do def maybe_format_urls(urls, :htcacheclean) do
urls urls
|> Enum.map(fn url -> |> Enum.map(fn url ->
uri = URI.parse(url) uri = URI.parse(url)
@ -58,5 +58,5 @@ defmodule Pleroma.Web.MediaProxy.Invalidation.Script do
end) end)
end end
def format_urls(urls, _), do: urls def maybe_format_urls(urls, _), do: urls
end end