Преглед изворни кода

Returns error when there is no query, but params expected.

master
damencho пре 8 година
родитељ
комит
64bb5563bc

+ 8
- 0
resources/prosody-plugins/mod_muc_poltergeist.lua Прегледај датотеку

169
 -- @param event the http event, holds the request query
169
 -- @param event the http event, holds the request query
170
 -- @return GET response, containing a json with response details
170
 -- @return GET response, containing a json with response details
171
 function handle_create_poltergeist (event)
171
 function handle_create_poltergeist (event)
172
+    if (not event.request.url.query) then
173
+        return 400;
174
+    end
175
+
172
     local params = parse(event.request.url.query);
176
     local params = parse(event.request.url.query);
173
     local user_id = params["user"];
177
     local user_id = params["user"];
174
     local room_name = params["room"];
178
     local room_name = params["room"];
194
 -- @param event the http event, holds the request query
198
 -- @param event the http event, holds the request query
195
 -- @return GET response, containing a json with response details
199
 -- @return GET response, containing a json with response details
196
 function handle_update_poltergeist (event)
200
 function handle_update_poltergeist (event)
201
+    if (not event.request.url.query) then
202
+        return 400;
203
+    end
204
+
197
     local params = parse(event.request.url.query);
205
     local params = parse(event.request.url.query);
198
     local user_id = params["user"];
206
     local user_id = params["user"];
199
     local room_name = params["room"];
207
     local room_name = params["room"];

+ 8
- 0
resources/prosody-plugins/mod_muc_size.lua Прегледај датотеку

72
 -- @return GET response, containing a json with participants count,
72
 -- @return GET response, containing a json with participants count,
73
 --         tha value is without counting the focus.
73
 --         tha value is without counting the focus.
74
 function handle_get_room_size(event)
74
 function handle_get_room_size(event)
75
+    if (not event.request.url.query) then
76
+        return 400;
77
+    end
78
+
75
 	local params = parse(event.request.url.query);
79
 	local params = parse(event.request.url.query);
76
 	local room_name = params["room"];
80
 	local room_name = params["room"];
77
 	local domain_name = params["domain"];
81
 	local domain_name = params["domain"];
121
 -- @param event the http event, holds the request query
125
 -- @param event the http event, holds the request query
122
 -- @return GET response, containing a json with participants details
126
 -- @return GET response, containing a json with participants details
123
 function handle_get_room (event)
127
 function handle_get_room (event)
128
+    if (not event.request.url.query) then
129
+        return 400;
130
+    end
131
+
124
 	local params = parse(event.request.url.query);
132
 	local params = parse(event.request.url.query);
125
 	local room_name = params["room"];
133
 	local room_name = params["room"];
126
 	local domain_name = params["domain"];
134
 	local domain_name = params["domain"];

Loading…
Откажи
Сачувај