Mercurial > prosody-hg
comparison util/dataforms.lua @ 14173:44e5c73e6fa3 13.0
util.dataforms: Don't treat invalid jid-multi as missing
If all the submitted JIDs were invalid, #results would be 0 and the field
would be treated as absent rather than invalid.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 25 May 2026 13:14:53 +0100 |
| parents | d10957394a3c |
| children |
comparison
equal
deleted
inserted
replaced
| 14172:94172bbf9074 | 14173:44e5c73e6fa3 |
|---|---|
| 250 result[#result+1] = value; | 250 result[#result+1] = value; |
| 251 if raw_value and not value then | 251 if raw_value and not value then |
| 252 err[#err+1] = ("Invalid JID: " .. raw_value); | 252 err[#err+1] = ("Invalid JID: " .. raw_value); |
| 253 end | 253 end |
| 254 end | 254 end |
| 255 if #result > 0 then | 255 if #result > 0 or #err > 0 then |
| 256 return result, (#err > 0 and t_concat(err, "\n") or nil); | 256 return result, (#err > 0 and t_concat(err, "\n") or nil); |
| 257 elseif required then | 257 elseif required then |
| 258 return nil, "Required value missing"; | 258 return nil, "Required value missing"; |
| 259 end | 259 end |
| 260 end | 260 end |
