plugins/mod_http_file_share.lua
changeset 11869 77bbbd4263d7
parent 11868 fceebfb28d86
child 11877 2b85e4e7d389
equal deleted inserted replaced
11868:fceebfb28d86 11869:77bbbd4263d7
   287 		local fh, err = io.open(filename.."~", "w");
   287 		local fh, err = io.open(filename.."~", "w");
   288 		if not fh then
   288 		if not fh then
   289 			module:log("error", "Could not open file for writing: %s", err);
   289 			module:log("error", "Could not open file for writing: %s", err);
   290 			return 500;
   290 			return 500;
   291 		end
   291 		end
   292 		function event.response:on_destroy()
   292 		function event.response:on_destroy() -- luacheck: ignore 212/self
   293 			-- Clean up incomplete upload
   293 			-- Clean up incomplete upload
   294 			if io.type(fh) == "file" then -- still open
   294 			if io.type(fh) == "file" then -- still open
   295 				fh:close();
   295 				fh:close();
   296 				os.remove(filename.."~");
   296 				os.remove(filename.."~");
   297 			end
   297 			end