logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 563aebd5ce8e713dec2cb7ce47dbc7fc04473266
parent 60d89cb40455f9f70b683849dd95311975b0b6f7
Author: Mark Felder <feld@feld.me>
Date:   Sun, 28 Jan 2024 10:20:44 -0500

Pleroma.Web.Plugs.UploadedMedia: dialyzer error

lib/pleroma/web/plugs/uploaded_media.ex:98:call
The function call will not succeed.

Pleroma.ReverseProxy.call(
  _conn :: %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  _url :: any(),
  _proxy_opts :: [{:http, [{:follow_redirect, true} | {:pool, :upload}, ...]}, ...]
)

breaks the contract
(Plug.Conn.t(), url :: String.t(), [option()]) :: Plug.Conn.t()

Diffstat:

Mlib/pleroma/reverse_proxy.ex6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/pleroma/reverse_proxy.ex b/lib/pleroma/reverse_proxy.ex @@ -84,13 +84,13 @@ defmodule Pleroma.ReverseProxy do {:max_read_duration, non_neg_integer() | :infinity} | {:max_body_length, non_neg_integer() | :infinity} | {:failed_request_ttl, non_neg_integer() | :infinity} - | {:http, []} + | {:http, keyword()} | {:req_headers, [{String.t(), String.t()}]} | {:resp_headers, [{String.t(), String.t()}]} - | {:inline_content_types, boolean() | [String.t()]} + | {:inline_content_types, boolean() | list(String.t())} | {:redirect_on_failure, boolean()} - @spec call(Plug.Conn.t(), url :: String.t(), [option()]) :: Plug.Conn.t() + @spec call(Plug.Conn.t(), String.t(), list(option())) :: Plug.Conn.t() def call(_conn, _url, _opts \\ []) def call(conn = %{method: method}, url, opts) when method in @methods do