Handle existing redirect params.
authorRoger Braun <roger@rogerbraun.net>
Fri, 10 Nov 2017 17:24:50 +0000 (18:24 +0100)
committerRoger Braun <roger@rogerbraun.net>
Fri, 10 Nov 2017 17:24:50 +0000 (18:24 +0100)
lib/pleroma/web/oauth/oauth_controller.ex

index 841df8c32d24d1a5f4b96bf2706f568fd4e61441..e8483dec061ee0338678c13fdaca9c4c553eb34d 100644 (file)
@@ -25,7 +25,8 @@ defmodule Pleroma.Web.OAuth.OAuthController do
           auth: auth
         }
       else
-        url = "#{redirect_uri}?code=#{auth.token}"
+        connector = if String.contains?(redirect_uri, "?"), do: "&", else: "?"
+        url = "#{redirect_uri}#{connector}code=#{auth.token}"
         url = if params["state"] do
           url <> "&state=#{params["state"]}"
         else