aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/mod_http_file_share.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua
index c67a1649..f57257bb 100644
--- a/plugins/mod_http_file_share.lua
+++ b/plugins/mod_http_file_share.lua
@@ -289,6 +289,13 @@ function handle_upload(event, path) -- PUT /upload/:slot
module:log("error", "Could not open file for writing: %s", err);
return 500;
end
+ function event.response:on_destroy()
+ -- Clean up incomplete upload
+ if io.type(fh) == "file" then -- still open
+ fh:close();
+ os.remove(filename.."~");
+ end
+ end
request.body_sink = fh;
if request.body == false then
if request.headers.expect == "100-continue" then