Changeset

4112:d0366474aace

mod_invites_register_web: Fix traceback on missing query params
author Matthew Wild <mwild1@gmail.com>
date Sat, 12 Sep 2020 10:28:28 +0100
parents 4111:ae2699f1cba9
children 4113:c85af57e82e0
files mod_invites_register_web/mod_invites_register_web.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_invites_register_web/mod_invites_register_web.lua	Sat Sep 12 08:23:09 2020 +0100
+++ b/mod_invites_register_web/mod_invites_register_web.lua	Sat Sep 12 10:28:28 2020 +0100
@@ -22,14 +22,14 @@
 function serve_register_page(event)
 	local register_page_template = assert(module:load_resource("html/register.html")):read("*a");
 
-	local query_params = http_formdecode(event.request.url.query);
+	local query_params = event.request.url.query and http_formdecode(event.request.url.query);
 
-	local invite = invites.get(query_params.t);
+	local invite = query_params and invites.get(query_params.t);
 	if not invite then
 		return {
 			status_code = 303;
 			headers = {
-				["Location"] = invites.module:http_url().."?"..event.request.url.query;
+				["Location"] = invites.module:http_url().."?"..(event.request.url.query or "");
 			};
 		};
 	end