Mercurial > prosody-modules
comparison mod_http_upload/mod_http_upload.lua @ 2192:bb8f7785aed7
mod_http_upload: Demote some errors to warnings
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 31 May 2016 17:13:48 +0200 |
| parents | e47046abf568 |
| children | 40824a38d505 |
comparison
equal
deleted
inserted
replaced
| 2191:e47046abf568 | 2192:bb8f7785aed7 |
|---|---|
| 89 local random, filename = path:match("^([^/]+)/([^/]+)$"); | 89 local random, filename = path:match("^([^/]+)/([^/]+)$"); |
| 90 if not random then | 90 if not random then |
| 91 return 400; | 91 return 400; |
| 92 end | 92 end |
| 93 if #event.request.body > file_size_limit then | 93 if #event.request.body > file_size_limit then |
| 94 module:log("error", "Uploaded file too large %d bytes", #event.request.body); | 94 module:log("warn", "Uploaded file too large %d bytes", #event.request.body); |
| 95 return 400; | 95 return 400; |
| 96 end | 96 end |
| 97 local dirname = join_path(storage_path, random); | 97 local dirname = join_path(storage_path, random); |
| 98 if not lfs.mkdir(dirname) then | 98 if not lfs.mkdir(dirname) then |
| 99 module:log("error", "Could not create directory %s for upload", dirname); | 99 module:log("warn", "Could not create directory %s for upload", dirname); |
| 100 return 500; | 100 return 500; |
| 101 end | 101 end |
| 102 local full_filename = join_path(dirname, filename); | 102 local full_filename = join_path(dirname, filename); |
| 103 local fh, ferr = io.open(full_filename, "w"); | 103 local fh, ferr = io.open(full_filename, "w"); |
| 104 if not fh then | 104 if not fh then |
