comparison mod_http_upload/mod_http_upload.lua @ 3648:aa12b95a6d36

mod_http_upload: Ensure integer formatting of size limit Prevents problems when running under Lua 5.3+ where floating point numbers always have a decimal dot when tostring()-ed.
author Kim Alvefur <zash@zash.se>
date Thu, 22 Aug 2019 23:57:57 +0200
parents a578b4977bb0
children d252c8573f33
comparison
equal deleted inserted replaced
3647:a0ca5d0a49ba 3648:aa12b95a6d36
91 module:add_feature(legacy_namespace); 91 module:add_feature(legacy_namespace);
92 92
93 module:add_extension(dataform { 93 module:add_extension(dataform {
94 { name = "FORM_TYPE", type = "hidden", value = namespace }, 94 { name = "FORM_TYPE", type = "hidden", value = namespace },
95 { name = "max-file-size", type = "text-single" }, 95 { name = "max-file-size", type = "text-single" },
96 }:form({ ["max-file-size"] = tostring(file_size_limit) }, "result")); 96 }:form({ ["max-file-size"] = ("%d"):format(file_size_limit) }, "result"));
97 97
98 module:add_extension(dataform { 98 module:add_extension(dataform {
99 { name = "FORM_TYPE", type = "hidden", value = legacy_namespace }, 99 { name = "FORM_TYPE", type = "hidden", value = legacy_namespace },
100 { name = "max-file-size", type = "text-single" }, 100 { name = "max-file-size", type = "text-single" },
101 }:form({ ["max-file-size"] = tostring(file_size_limit) }, "result")); 101 }:form({ ["max-file-size"] = ("%d"):format(file_size_limit) }, "result"));
102 102
103 -- state 103 -- state
104 local pending_slots = module:shared("upload_slots"); 104 local pending_slots = module:shared("upload_slots");
105 105
106 local storage_path = module:get_option_string(module.name .. "_path", join_path(prosody.paths.data, module.name)); 106 local storage_path = module:get_option_string(module.name .. "_path", join_path(prosody.paths.data, module.name));