diff --git a/lib/pleroma/frontend.ex b/lib/pleroma/frontend.ex index cd49a4899..18bb6c488 100644 --- a/lib/pleroma/frontend.ex +++ b/lib/pleroma/frontend.ex @@ -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 diff --git a/lib/pleroma/web/admin_api/controllers/frontend_controller.ex b/lib/pleroma/web/admin_api/controllers/frontend_controller.ex index f174c43d6..c1332bdcd 100644 --- a/lib/pleroma/web/admin_api/controllers/frontend_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/frontend_controller.ex @@ -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