fixed wrong reqbody for delete, added explicit slot_type also for upload request, variable misspelling corrected
This commit is contained in:
parent
25e8420fdb
commit
15090fe1be
1 changed files with 3 additions and 3 deletions
|
@ -59,7 +59,7 @@ module:hook("iq/host/"..xmlns_http_upload..":request", function (event)
|
||||||
local content_type = request:get_child_text("content-type");
|
local content_type = request:get_child_text("content-type");
|
||||||
|
|
||||||
-- build the body
|
-- build the body
|
||||||
local reqbody = "xmpp_server_key=" .. xmpp_server_key .. "&size=" .. filesize .. "&filename=" .. filename .. "&user_jid=" .. orig_from;
|
local reqbody = "xmpp_server_key=" .. xmpp_server_key .. "&slot_type=upload&size=" .. filesize .. "&filename=" .. filename .. "&user_jid=" .. orig_from;
|
||||||
if content_type then
|
if content_type then
|
||||||
reqbody = reqbody .. "&content_type=" .. content_type;
|
reqbody = reqbody .. "&content_type=" .. content_type;
|
||||||
end
|
end
|
||||||
|
@ -142,7 +142,7 @@ module:hook("iq/host/"..xmlns_http_upload..":request", function (event)
|
||||||
return true;
|
return true;
|
||||||
end
|
end
|
||||||
-- build the body
|
-- build the body
|
||||||
local reqbody = "xmpp_server_key=" .. xmpp_server_key .. "&size=" .. filesize .. "&filename=" .. filename .. "&user_jid=" .. orig_from;
|
local reqbody = "xmpp_server_key=" .. xmpp_server_key .. "slot_type=delete&file_url=" .. fileurl .. "&user_jid=" .. orig_from;
|
||||||
-- the request
|
-- the request
|
||||||
local respbody, statuscode = http.request(external_url, reqbody);
|
local respbody, statuscode = http.request(external_url, reqbody);
|
||||||
respbody = string.gsub(respbody, "\\/", "/")
|
respbody = string.gsub(respbody, "\\/", "/")
|
||||||
|
@ -194,7 +194,7 @@ module:hook("iq/host/"..xmlns_http_upload..":request", function (event)
|
||||||
|
|
||||||
local reply = st.reply(stanza);
|
local reply = st.reply(stanza);
|
||||||
reply:tag("slot", { xmlns = xmlns_http_upload });
|
reply:tag("slot", { xmlns = xmlns_http_upload });
|
||||||
reply:tag("deletetoken"):text(deletetoken):up();
|
reply:tag("deletetoken"):text(delete_token):up();
|
||||||
origin.send(reply);
|
origin.send(reply);
|
||||||
else
|
else
|
||||||
origin.send(st.error_reply(stanza, "cancel", "undefined-condition", "status code: " .. statuscode .. " response: " ..respbody));
|
origin.send(st.error_reply(stanza, "cancel", "undefined-condition", "status code: " .. statuscode .. " response: " ..respbody));
|
||||||
|
|
Loading…
Reference in a new issue