prosody-module: treat empty file url also as invalid;

treat status code 404 (not available) in case of deleting a file the same as 204 (deleted by this operation)
This commit is contained in:
steckbrief 2017-05-27 20:31:32 +02:00
parent 0885d997f9
commit 16d3261f03

View file

@ -121,7 +121,7 @@ end
local function deletefile(origin, orig_from, stanza, request)
-- validate
local fileurl = request:get_child_text("fileurl");
if not fileurl then
if not fileurl or fileurl == '' then
origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid fileurl"));
return true;
end
@ -169,7 +169,7 @@ local function deletefile(origin, orig_from, stanza, request)
return true;
end
end
elseif statuscode == 204 then
elseif statuscode == 204 or statuscode == 404 then
local reply = st.reply(stanza);
reply:tag("deleted", { xmlns = xmlns_http_upload });
origin.send(reply);