From 17a85e6d3b542eff9e433098c469c57e2c02c30f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 27 Jan 2021 17:48:12 +0100 Subject: mod_http_file_share: Use '.bin' file extension Distinct from '.dat' used by datamanager / internal stortage for Lua object storage so that they can't easily be loaded by accident that way. --- plugins/mod_http_file_share.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua index 25efdaa8..55af15a1 100644 --- a/plugins/mod_http_file_share.lua +++ b/plugins/mod_http_file_share.lua @@ -171,7 +171,8 @@ function handle_upload(event, path) -- PUT /upload/:slot -- so we also check the final file size on completion. end - local filename = dm.getpath(upload_info.slot, module.host, module.name, nil, true); + local filename = dm.getpath(upload_info.slot, module.host, module.name, "bin", true); + if not request.body_sink then module:log("debug", "Preparing to receive upload into %q, expecting %s", filename, B(upload_info.filesize)); @@ -228,7 +229,7 @@ function handle_download(event, path) -- GET /uploads/:slot+filename if request.headers.if_modified_since == last_modified then return 304; end - local filename = dm.getpath(slot_id, module.host, module.name); + local filename = dm.getpath(slot_id, module.host, module.name, "bin"); local handle, ferr = errors.coerce(io.open(filename)); if not handle then return ferr or 410; -- cgit v1.2.3