diff options
author | Kim Alvefur <zash@zash.se> | 2021-02-13 14:14:12 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-02-13 14:14:12 +0100 |
commit | 3151984042357496feee707bf63b9115c2bca2cb (patch) | |
tree | 9360c5311e8d2224cb22d46f49ecca24a606ee12 /plugins/mod_http_file_share.lua | |
parent | 9501c7b976dc208d4ab6b9f92764aca9c46aa6a7 (diff) | |
download | prosody-3151984042357496feee707bf63b9115c2bca2cb.tar.gz prosody-3151984042357496feee707bf63b9115c2bca2cb.zip |
mod_http_file_share: Prevent attempt to upload again after completion
Diffstat (limited to 'plugins/mod_http_file_share.lua')
-rw-r--r-- | plugins/mod_http_file_share.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua index 2af4e0ca..1ce5a8bb 100644 --- a/plugins/mod_http_file_share.lua +++ b/plugins/mod_http_file_share.lua @@ -224,6 +224,15 @@ function handle_upload(event, path) -- PUT /upload/:slot local filename = get_filename(upload_info.slot, true); + do + -- check if upload has been completed already + -- we want to allow retry of a failed upload attempt, but not after it's been completed + local f = io.open(filename, "r"); + if f then + f:close(); + return 409; + end + end if not request.body_sink then module:log("debug", "Preparing to receive upload into %q, expecting %s", filename, B(upload_info.filesize)); |