# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Upload do
require Logger
@type source ::
- Plug.Upload.t() | data_uri_string ::
- String.t() | {:from_local, name :: String.t(), id :: String.t(), path :: String.t()}
+ Plug.Upload.t()
+ | (data_uri_string :: String.t())
+ | {:from_local, name :: String.t(), id :: String.t(), path :: String.t()}
@type option ::
{:type, :avatar | :banner | :background}
end
defp url_from_spec(base_url, {:file, path}) do
+ path =
+ path
+ |> URI.encode()
+ |> String.replace("?", "%3F")
+ |> String.replace(":", "%3A")
+
[base_url, "media", path]
|> Path.join()
end