From 4d1cf1787db50b8f61fb81a86dabd36b15b6889b Mon Sep 17 00:00:00 2001 From: jasquat Date: Wed, 19 Oct 2022 14:33:03 -0400 Subject: [PATCH] check if there are params in the redirect url before adding the response to ensure we have the correct symbol --- app.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 1969f1d..423b8e7 100644 --- a/app.py +++ b/app.py @@ -5,6 +5,7 @@ import os import pkgutil import types import typing +import re from flask import Flask from flask import redirect @@ -112,7 +113,12 @@ def auth_callback(plugin_display_name, auth_name): # TODO compare redirect_url to whitelist - return redirect(f"{redirect_url}?response={response}") + redirect_url_params_symbol = "?" + print(f"redirect_url: {redirect_url}") + if re.match(r".*\?.*", redirect_url): + redirect_url_params_symbol = "&" + + return redirect(f"{redirect_url}{redirect_url_params_symbol}response={response}") @app.route("/v1/do//", methods = ["GET", "POST"])