Software / code / prosody-modules
Comparison
mod_rest/jsonmap.lib.lua @ 4947:b171ddf1bc3e
mod_rest: Treat archive.ids as comma-separated to work in query string
Can't easily put an array into a query string. Hope nobody puts commas
into their archive ids.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 21 May 2022 22:55:41 +0200 |
| parent | 4935:a85efae90e21 |
| child | 5119:048e339706ba |
comparison
equal
deleted
inserted
replaced
| 4946:cc14bfec209b | 4947:b171ddf1bc3e |
|---|---|
| 504 -- XEP-0313 conveninece mapping | 504 -- XEP-0313 conveninece mapping |
| 505 if kind == "iq" and t_type == "set" and type(t.archive) == "table" and not t.archive.form then | 505 if kind == "iq" and t_type == "set" and type(t.archive) == "table" and not t.archive.form then |
| 506 local archive = t.archive; | 506 local archive = t.archive; |
| 507 if archive["with"] or archive["start"] or archive["end"] or archive["before-id"] or archive["after-id"] | 507 if archive["with"] or archive["start"] or archive["end"] or archive["before-id"] or archive["after-id"] |
| 508 or archive["ids"] then | 508 or archive["ids"] then |
| 509 if type(archive["ids"]) == "string" then | |
| 510 local ids = {}; | |
| 511 for id in archive["ids"]:gmatch("[^,]+") do | |
| 512 table.insert(ids, id); | |
| 513 end | |
| 514 archive["ids"] = ids; | |
| 515 end | |
| 509 archive.form = { | 516 archive.form = { |
| 510 type = "submit"; | 517 type = "submit"; |
| 511 fields = { | 518 fields = { |
| 512 { var = "FORM_TYPE"; values = { "urn:xmpp:mam:2" } }; | 519 { var = "FORM_TYPE"; values = { "urn:xmpp:mam:2" } }; |
| 513 { var = "with"; values = { archive["with"] } }; | 520 { var = "with"; values = { archive["with"] } }; |