Fix FrontendController

This commit is contained in:
Alex Gleason 2021-06-14 19:02:13 -05:00
parent d9a45175c0
commit 811dcc1928
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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