Skip to content

Commit

Permalink
Add checks for cc/bcc/subject in mail.send() and mail.save_draft() ap…
Browse files Browse the repository at this point in the history
…i functions

Fix api new checks failed builds
  • Loading branch information
Athozus committed Jul 19, 2023
1 parent 9c041f5 commit 9990d56
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9990d56

Please sign in to comment.