Properly escape reserved URI charachters in upload urls
This commit is contained in:
parent
10248d86a2
commit
4263edc9c9
1 changed files with 5 additions and 3 deletions
|
@ -85,6 +85,10 @@ def store(upload, opts \\ []) do
|
|||
end
|
||||
end
|
||||
|
||||
def char_unescaped?(char) do
|
||||
URI.char_unreserved?(char) or char == ?/
|
||||
end
|
||||
|
||||
defp get_opts(opts) do
|
||||
{size_limit, activity_type} =
|
||||
case Keyword.get(opts, :type) do
|
||||
|
@ -218,9 +222,7 @@ defp tempfile_for_image(data) do
|
|||
defp url_from_spec(base_url, {:file, path}) do
|
||||
path =
|
||||
path
|
||||
|> URI.encode()
|
||||
|> String.replace("?", "%3F")
|
||||
|> String.replace(":", "%3A")
|
||||
|> URI.encode(&char_unescaped?/1)
|
||||
|
||||
[base_url, "media", path]
|
||||
|> Path.join()
|
||||
|
|
Loading…
Reference in a new issue