comparison mod_http_upload/mod_http_upload.lua @ 2681:8d8ba28d020f

mod_http_upload: Consider files deleted even if remove fails
author Kim Alvefur <zash@zash.se>
date Thu, 13 Apr 2017 20:59:55 +0200
parents 96bf67f1f960
children 3fd50495c89d
comparison
equal deleted inserted replaced
2680:96bf67f1f960 2681:8d8ba28d020f
79 uploads = array(uploads); 79 uploads = array(uploads);
80 local expiry = os.time() - max_age; 80 local expiry = os.time() - max_age;
81 uploads:filter(function (item) 81 uploads:filter(function (item)
82 if item.time < expiry then 82 if item.time < expiry then
83 local deleted, whynot = os.remove(item.filename); 83 local deleted, whynot = os.remove(item.filename);
84 if deleted then 84 if not deleted then
85 return false;
86 else
87 module:log("warn", "Could not delete expired upload %s: %s", item.filename, whynot or "delete failed"); 85 module:log("warn", "Could not delete expired upload %s: %s", item.filename, whynot or "delete failed");
88 end 86 end
87 return false;
89 end 88 end
90 return true; 89 return true;
91 end); 90 end);
92 return datamanager.list_store(username, host, module.name, uploads); 91 return datamanager.list_store(username, host, module.name, uploads);
93 end 92 end