Skip to content
Snippets Groups Projects
Commit 4263edc9 authored by rinpatch's avatar rinpatch
Browse files

Properly escape reserved URI charachters in upload urls

parent 10248d86
No related branches found
No related tags found
No related merge requests found
......@@ -85,6 +85,10 @@ defmodule Pleroma.Upload 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 @@ defmodule Pleroma.Upload 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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment