Comparison

mod_http_upload/mod_http_upload.lua @ 3589:dec5683f91a2

mod_http_upload: Check attempted upload against quota even with no previous uploads
author Kim Alvefur <zash@zash.se>
date Wed, 08 May 2019 13:50:49 +0200
parent 3588:85057c4e7b66
child 3590:d8cc8b71a199
comparison
equal deleted inserted replaced
3588:85057c4e7b66 3589:dec5683f91a2
108 if not quota then return true; end 108 if not quota then return true; end
109 local uploads, err = datamanager.list_load(username, host, module.name); 109 local uploads, err = datamanager.list_load(username, host, module.name);
110 if err then 110 if err then
111 return false; 111 return false;
112 elseif not uploads then 112 elseif not uploads then
113 if does_it_fit then
114 return does_it_fit < quota;
115 end
113 return true; 116 return true;
114 end 117 end
115 local sum = does_it_fit or 0; 118 local sum = does_it_fit or 0;
116 for _, item in ipairs(uploads) do 119 for _, item in ipairs(uploads) do
117 sum = sum + item.size; 120 sum = sum + item.size;