Changeset

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
parents 4946:cc14bfec209b
children 4948:2ff1fa824c5d
files mod_rest/jsonmap.lib.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua	Sat May 21 14:48:18 2022 +0200
+++ b/mod_rest/jsonmap.lib.lua	Sat May 21 22:55:41 2022 +0200
@@ -506,6 +506,13 @@
 		local archive = t.archive;
 		if archive["with"] or archive["start"] or archive["end"] or archive["before-id"] or archive["after-id"]
 			or archive["ids"] then
+			if type(archive["ids"]) == "string" then
+				local ids = {};
+				for id in archive["ids"]:gmatch("[^,]+") do
+					table.insert(ids, id);
+				end
+				archive["ids"] = ids;
+			end
 			archive.form = {
 				type = "submit";
 				fields = {