Mercurial > prosody-modules
comparison mod_http_upload/mod_http_upload.lua @ 3588:85057c4e7b66
mod_http_upload: Consider quota reached if it can't be checked
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 08 May 2019 13:48:24 +0200 |
parents | b059a3fb2a58 |
children | dec5683f91a2 |
comparison
equal
deleted
inserted
replaced
3587:c24d43ababc6 | 3588:85057c4e7b66 |
---|---|
105 end | 105 end |
106 | 106 |
107 local function check_quota(username, host, does_it_fit) | 107 local function check_quota(username, host, does_it_fit) |
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 not uploads then return true; end | 110 if err then |
111 return false; | |
112 elseif not uploads then | |
113 return true; | |
114 end | |
111 local sum = does_it_fit or 0; | 115 local sum = does_it_fit or 0; |
112 for _, item in ipairs(uploads) do | 116 for _, item in ipairs(uploads) do |
113 sum = sum + item.size; | 117 sum = sum + item.size; |
114 end | 118 end |
115 return sum < quota; | 119 return sum < quota; |