mod_http_upload: Ensure integer formatting of size limit
authorKim Alvefur <zash@zash.se>
Thu, 22 Aug 2019 23:57:57 +0200
changeset 3652 aa12b95a6d36
parent 3651 a0ca5d0a49ba
child 3653 d252c8573f33
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.
mod_http_upload/mod_http_upload.lua
--- a/mod_http_upload/mod_http_upload.lua	Wed Aug 21 00:38:20 2019 +0200
+++ b/mod_http_upload/mod_http_upload.lua	Thu Aug 22 23:57:57 2019 +0200
@@ -93,12 +93,12 @@
 module:add_extension(dataform {
 	{ name = "FORM_TYPE", type = "hidden", value = namespace },
 	{ name = "max-file-size", type = "text-single" },
-}:form({ ["max-file-size"] = tostring(file_size_limit) }, "result"));
+}:form({ ["max-file-size"] = ("%d"):format(file_size_limit) }, "result"));
 
 module:add_extension(dataform {
 	{ name = "FORM_TYPE", type = "hidden", value = legacy_namespace },
 	{ name = "max-file-size", type = "text-single" },
-}:form({ ["max-file-size"] = tostring(file_size_limit) }, "result"));
+}:form({ ["max-file-size"] = ("%d"):format(file_size_limit) }, "result"));
 
 -- state
 local pending_slots = module:shared("upload_slots");