Front end deps upgrades and fixes

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-07-23 17:14:03 +02:00
parent 93984eb53a
commit 1cd511f440
4 changed files with 516 additions and 432 deletions

View File

@@ -91,10 +91,12 @@ defmodule MobilizonWeb.Upload do
def remove(url, opts \\ []) do
with opts <- get_opts(opts),
%URI{path: "/media/" <> path, host: host} <- URI.parse(url),
true <- host == MobilizonWeb.Endpoint.host() do
{:same_host, true} <- {:same_host, host == MobilizonWeb.Endpoint.host()} do
MobilizonWeb.Uploaders.Uploader.remove_file(opts.uploader, path)
else
%URI{} = _uri -> {:error, "URL doesn't match pattern"}
{:same_host, _} ->
Logger.error("Media can't be deleted because its URL doesn't match current host")
end
end