diff --git a/lib/bdfr_browser/http/plug.ex b/lib/bdfr_browser/http/plug.ex index dcba710..6fcb559 100644 --- a/lib/bdfr_browser/http/plug.ex +++ b/lib/bdfr_browser/http/plug.ex @@ -138,7 +138,12 @@ defmodule BdfrBrowser.HTTP.Plug do defp media_path(full_path) do base_directory = Application.fetch_env!(:bdfr_browser, :base_directory) - String.replace(full_path, "#{base_directory}/", "/media/") + + full_path + |> String.replace("#{base_directory}/", "/media/") + |> String.split("/") + |> Enum.map(fn p -> URI.encode(p, &URI.char_unreserved?/1) end) + |> Enum.join("/") end defp mime_from_ext(path) do diff --git a/priv/templates/http/post.eex b/priv/templates/http/post.eex index 88f47d5..f32f4db 100644 --- a/priv/templates/http/post.eex +++ b/priv/templates/http/post.eex @@ -27,7 +27,7 @@