From: Dominique Feyer Date: Sun, 9 Sep 2018 21:31:47 +0000 (+0200) Subject: Add missing URL encoding in create authorization redirect X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=b79c126ee0977e44e21f275418862fede0e1f346;p=akkoma Add missing URL encoding in create authorization redirect --- diff --git a/lib/pleroma/web/oauth/oauth_controller.ex b/lib/pleroma/web/oauth/oauth_controller.ex index 160cedd8e..8fe0dde6e 100644 --- a/lib/pleroma/web/oauth/oauth_controller.ex +++ b/lib/pleroma/web/oauth/oauth_controller.ex @@ -39,15 +39,18 @@ defmodule Pleroma.Web.OAuth.OAuthController do }) else connector = if String.contains?(redirect_uri, "?"), do: "&", else: "?" - url = "#{redirect_uri}#{connector}code=#{auth.token}" + url = "#{redirect_uri}#{connector}" + url_params = %{:code => auth.token} - url = + url_params = if params["state"] do - url <> "&state=#{params["state"]}" + Map.put(url_params, :state, params["state"]) else - url + url_params end + url = "#{url}#{Plug.Conn.Query.encode url_params}" + redirect(conn, external: url) end end