mod_http_oauth2: Fix appending of query parts in error redirects
authorKim Alvefur <zash@zash.se>
Fri, 10 Mar 2023 11:54:30 +0100
changeset 5233 c24a622a7b85
parent 5232 77cd01af06a9
child 5234 ac252db71027
mod_http_oauth2: Fix appending of query parts in error redirects Looks like this meant to check whether the redirect_uri has a ?query part, but forgot to inspect the field for this in the returned table.
mod_http_oauth2/mod_http_oauth2.lua
--- a/mod_http_oauth2/mod_http_oauth2.lua	Thu Mar 09 14:46:06 2023 +0100
+++ b/mod_http_oauth2/mod_http_oauth2.lua	Fri Mar 10 11:54:30 2023 +0100
@@ -429,7 +429,7 @@
 		return render_page(templates.error, { error = err });
 	end
 	local redirect_query = url.parse(redirect_uri);
-	local sep = redirect_query and "&" or "?";
+	local sep = redirect_query.query and "&" or "?";
 	redirect_uri = redirect_uri
 		.. sep .. http.formencode(err.extra.oauth2_response)
 		.. "&" .. http.formencode({ state = q.state, iss = get_issuer() });