Comparison

plugins/mod_http_file_share.lua @ 11873:2b85e4e7d389

mod_http_file_share: Move number coercion into util.dataforms
author Kim Alvefur <zash@zash.se>
date Mon, 25 Oct 2021 21:45:06 +0200
parent 11865:77bbbd4263d7
child 11990:6f4790b8deec
comparison
equal deleted inserted replaced
11872:ffff0d8a9c68 11873:2b85e4e7d389
45 module:depends("http"); 45 module:depends("http");
46 end 46 end
47 47
48 module:add_extension(dataform { 48 module:add_extension(dataform {
49 { name = "FORM_TYPE", type = "hidden", value = namespace }, 49 { name = "FORM_TYPE", type = "hidden", value = namespace },
50 { name = "max-file-size", type = "text-single" }, 50 { name = "max-file-size", type = "text-single", datatype = "xs:integer" },
51 }:form({ ["max-file-size"] = tostring(file_size_limit) }, "result")); 51 }:form({ ["max-file-size"] = file_size_limit }, "result"));
52 52
53 local upload_errors = errors.init(module.name, namespace, { 53 local upload_errors = errors.init(module.name, namespace, {
54 access = { type = "auth"; condition = "forbidden" }; 54 access = { type = "auth"; condition = "forbidden" };
55 filename = { type = "modify"; condition = "bad-request"; text = "Invalid filename" }; 55 filename = { type = "modify"; condition = "bad-request"; text = "Invalid filename" };
56 filetype = { type = "modify"; condition = "not-acceptable"; text = "File type not allowed" }; 56 filetype = { type = "modify"; condition = "not-acceptable"; text = "File type not allowed" };