check if there are params in the redirect url before adding the response to ensure we have the correct symbol

This commit is contained in:
jasquat 2022-10-19 14:33:03 -04:00
parent a30fff5650
commit 4d1cf1787d

8
app.py
View File

@ -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/<plugin_display_name>/<command_name>", methods = ["GET", "POST"])