Comparison

plugins/mod_http_file_share.lua @ 11500:21706a581b8a

mod_http_file_share: Log error opening file for writing util.error.coerce() doesn't work well with iolib
author Kim Alvefur <zash@zash.se>
date Mon, 05 Apr 2021 16:24:39 +0200
parent 11499:a8cbbbb1f165
child 11501:2c9db2278fed
comparison
equal deleted inserted replaced
11499:a8cbbbb1f165 11500:21706a581b8a
243 end 243 end
244 end 244 end
245 245
246 if not request.body_sink then 246 if not request.body_sink then
247 module:log("debug", "Preparing to receive upload into %q, expecting %s", filename, B(upload_info.filesize)); 247 module:log("debug", "Preparing to receive upload into %q, expecting %s", filename, B(upload_info.filesize));
248 local fh, err = errors.coerce(io.open(filename.."~", "w")); 248 local fh, err = io.open(filename.."~", "w");
249 if not fh then 249 if not fh then
250 return err; 250 module:log("error", "Could not open file for writing: %s", err);
251 return 500;
251 end 252 end
252 request.body_sink = fh; 253 request.body_sink = fh;
253 if request.body == false then 254 if request.body == false then
254 if request.headers.expect == "100-continue" then 255 if request.headers.expect == "100-continue" then
255 request.conn:write("HTTP/1.1 100 Continue\r\n\r\n"); 256 request.conn:write("HTTP/1.1 100 Continue\r\n\r\n");