Fix FrontendController
This commit is contained in:
parent
d9a45175c0
commit
811dcc1928
@ -94,10 +94,11 @@ defmodule Pleroma.Frontend do
|
||||
|> Path.join("frontends")
|
||||
end
|
||||
|
||||
defp download_or_unzip(%Frontend{file: nil} = frontend, dest),
|
||||
do: download_build(frontend, dest)
|
||||
defp download_or_unzip(%Frontend{build_url: build_url} = frontend, dest)
|
||||
when is_binary(build_url),
|
||||
do: download_build(frontend, dest)
|
||||
|
||||
defp download_or_unzip(%Frontend{file: file}, dest) do
|
||||
defp download_or_unzip(%Frontend{file: file}, dest) when is_binary(file) do
|
||||
with {:ok, zip} <- File.read(Path.expand(file)) do
|
||||
unzip(zip, dest)
|
||||
end
|
||||
|
@ -30,9 +30,8 @@ defmodule Pleroma.Web.AdminAPI.FrontendController do
|
||||
end
|
||||
|
||||
def install(%{body_params: params} = conn, _params) do
|
||||
frontend = params_to_frontend(params)
|
||||
|
||||
with :ok <- Frontend.install(frontend) do
|
||||
with %Frontend{} = frontend <- params_to_frontend(params),
|
||||
%Frontend{} <- Frontend.install(frontend) do
|
||||
index(conn, %{})
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user