Mercurial > prosody-modules
comparison mod_http_upload/mod_http_upload.lua @ 2732:b1c5b0c369c2
mod_http_upload: Remove directory when deleting a file (fixes #950)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 27 Jul 2017 16:46:18 +0200 |
parents | d48faff92490 |
children | 46b29a377bdf |
comparison
equal
deleted
inserted
replaced
2731:d48faff92490 | 2732:b1c5b0c369c2 |
---|---|
86 if item.time < expiry then | 86 if item.time < expiry then |
87 local deleted, whynot = os.remove(filename); | 87 local deleted, whynot = os.remove(filename); |
88 if not deleted then | 88 if not deleted then |
89 module:log("warn", "Could not delete expired upload %s: %s", filename, whynot or "delete failed"); | 89 module:log("warn", "Could not delete expired upload %s: %s", filename, whynot or "delete failed"); |
90 end | 90 end |
91 os.remove(filename:match("^(.*)[/\\]")); | |
91 return false; | 92 return false; |
92 elseif item.time < upload_window and not lfs.attributes(filename) then | 93 elseif item.time < upload_window and not lfs.attributes(filename) then |
93 return false; -- File was not uploaded or has been deleted since | 94 return false; -- File was not uploaded or has been deleted since |
94 end | 95 end |
95 return true; | 96 return true; |