# HG changeset patch # User Kim Alvefur # Date 1485706957 -3600 # Node ID 290fef768a81e32b138e399f1d1c613e14466112 # Parent 349008f9452dbeac450704857beca7556efee506 mod_http_upload: Forget upload slot under some error conditions diff -r 349008f9452d -r 290fef768a81 mod_http_upload/mod_http_upload.lua --- a/mod_http_upload/mod_http_upload.lua Sun Jan 29 16:51:25 2017 +0100 +++ b/mod_http_upload/mod_http_upload.lua Sun Jan 29 17:22:37 2017 +0100 @@ -103,7 +103,8 @@ -- http service local function upload_data(event, path) - if not pending_slots[path] then + local uploader = pending_slots[path]; + if not uploader then module:log("warn", "Attempt to upload to unknown slot %q", path); return; -- 404 end @@ -121,6 +122,7 @@ module:log("warn", "Could not create directory %s for upload", dirname); return 500; end + pending_slots[path] = nil; local full_filename = join_path(dirname, filename); local fh, ferr = io.open(full_filename, "w"); if not fh then @@ -139,8 +141,7 @@ os.remove(full_filename); return 500; end - module:log("info", "File uploaded by %s to slot %s", pending_slots[path], random); - pending_slots[path] = nil; + module:log("info", "File uploaded by %s to slot %s", uploader, random); return 200; end