mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-31 12:28:43 +00:00
Remove workaround for URI.merge bug on nil fields before Elixir 1.13
https://github.com/elixir-lang/elixir/issues/10771
This commit is contained in:
parent
010edcbcb5
commit
e65555e8c5
1 changed files with 1 additions and 13 deletions
|
@ -803,19 +803,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
|
|
||||||
defp build_application(_), do: nil
|
defp build_application(_), do: nil
|
||||||
|
|
||||||
# Workaround for Elixir issue #10771
|
@spec build_image_url(URI.t(), URI.t()) :: String.t()
|
||||||
# Avoid applying URI.merge unless necessary
|
|
||||||
# TODO: revert to always attempting URI.merge(image_url_data, page_url_data)
|
|
||||||
# when Elixir 1.12 is the minimum supported version
|
|
||||||
@spec build_image_url(struct() | nil, struct()) :: String.t() | nil
|
|
||||||
defp build_image_url(
|
|
||||||
%URI{scheme: image_scheme, host: image_host} = image_url_data,
|
|
||||||
%URI{} = _page_url_data
|
|
||||||
)
|
|
||||||
when not is_nil(image_scheme) and not is_nil(image_host) do
|
|
||||||
image_url_data |> to_string
|
|
||||||
end
|
|
||||||
|
|
||||||
defp build_image_url(%URI{} = image_url_data, %URI{} = page_url_data) do
|
defp build_image_url(%URI{} = image_url_data, %URI{} = page_url_data) do
|
||||||
URI.merge(page_url_data, image_url_data) |> to_string
|
URI.merge(page_url_data, image_url_data) |> to_string
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue