Pleroma.Web.OAuth.OAuthController: dialyzer error

validate_scopes/2 can never receive a map as it is only called in one place with a guard requiring a list

lib/pleroma/web/o_auth/o_auth_controller.ex:615:guard_fail
The guard test:

is_map(_params :: maybe_improper_list())

can never succeed.
This commit is contained in:
Mark Felder 2024-01-31 11:29:06 -05:00
parent 5e8bedcca0
commit 92992c022d
1 changed files with 1 additions and 6 deletions

View File

@ -610,13 +610,8 @@ defp build_and_response_mfa_token(user, auth) do
end end
end end
@spec validate_scopes(App.t(), map() | list()) :: @spec validate_scopes(App.t(), list()) ::
{:ok, list()} | {:error, :missing_scopes | :unsupported_scopes} {:ok, list()} | {:error, :missing_scopes | :unsupported_scopes}
defp validate_scopes(%App{} = app, params) when is_map(params) do
requested_scopes = Scopes.fetch_scopes(params, app.scopes)
validate_scopes(app, requested_scopes)
end
defp validate_scopes(%App{} = app, requested_scopes) when is_list(requested_scopes) do defp validate_scopes(%App{} = app, requested_scopes) when is_list(requested_scopes) do
Scopes.validate(requested_scopes, app.scopes) Scopes.validate(requested_scopes, app.scopes)
end end