From 9990d56004df71f64708f740cc0049c516dcac03 Mon Sep 17 00:00:00 2001 From: Athozus Date: Wed, 19 Jul 2023 22:16:27 +0200 Subject: [PATCH] Add checks for cc/bcc/subject in mail.send() and mail.save_draft() api functions Fix api new checks failed builds --- api.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api.lua b/api.lua index 48c398b..148d572 100644 --- a/api.lua +++ b/api.lua @@ -12,7 +12,10 @@ end function mail.send(m) if type(m.from) ~= "string" then return false, "'from' is not a string" end - if type(m.to) ~= "string" then return false, "'to' is not a string" end + if type(m.to or "") ~= "string" then return false, "'to' is not a string" end + if type(m.cc or "") ~= "string" then return false, "'cc' is not a string" end + if type(m.bcc or "") ~= "string" then return false, "'bcc' is not a string" end + if type(m.subject or "") ~= "string" then return false, "'subject' is not a string" end if type(m.body) ~= "string" then return false, "'body' is not a string" end -- defaults @@ -121,7 +124,10 @@ end function mail.save_draft(m) if type(m.from) ~= "string" then return false, "'from' is not a string" end - if type(m.to) ~= "string" then return false, "'to' is not a string" end + if type(m.to or "") ~= "string" then return false, "'to' is not a string" end + if type(m.cc or "") ~= "string" then return false, "'cc' is not a string" end + if type(m.bcc or "") ~= "string" then return false, "'bcc' is not a string" end + if type(m.subject or "") ~= "string" then return false, "'subject' is not a string" end if type(m.body) ~= "string" then return false, "'body' is not a string" end -- defaults