plugins/mod_http_file_share.lua
changeset 11320 ae0461b37fbe
parent 11319 c52fcea39c8e
child 11321 79e1f407b6f5
--- a/plugins/mod_http_file_share.lua	Tue Jan 26 14:53:43 2021 +0100
+++ b/plugins/mod_http_file_share.lua	Wed Jan 27 00:09:49 2021 +0100
@@ -173,7 +173,12 @@
 	end
 
 	if request.body_sink then
+		local final_size = request.body_sink:seek();
 		local uploaded, err = errors.coerce(request.body_sink:close());
+		if final_size ~= upload_info.filesize then
+			-- Could be too short as well, but we say the same thing
+			uploaded, err = false, 413;
+		end
 		if uploaded then
 			assert(os.rename(filename.."~", filename));
 			return 201;