# HG changeset patch # User Kim Alvefur # Date 1442227390 -7200 # Node ID e5243fa162102fb765cca040454d6851a3a0eaf7 # Parent cd98a1103ecf264ed901779070ee23daab26edea mod_http_upload: Cache first-level child in local variable diff -r cd98a1103ecf -r e5243fa16210 mod_http_upload/mod_http_upload.lua --- a/mod_http_upload/mod_http_upload.lua Mon Sep 14 12:42:08 2015 +0200 +++ b/mod_http_upload/mod_http_upload.lua Mon Sep 14 12:43:10 2015 +0200 @@ -34,13 +34,14 @@ -- hooks module:hook("iq/host/"..xmlns_http_upload..":request", function (event) local stanza, origin = event.stanza, event.origin; + local request = stanza.tags[1]; -- local clients only if origin.type ~= "c2s" then origin.send(st.error_reply(stanza, "cancel", "not-authorized")); return true; end -- validate - local filename = stanza.tags[1]:get_child_text("filename"); + local filename = request:get_child_text("filename"); if not filename or filename:find("/") then origin.send(st.error_reply(stanza, "modify", "bad-request")); return true;