aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-03-28 13:51:06 +0200
committerKim Alvefur <zash@zash.se>2021-03-28 13:51:06 +0200
commit1be4a5c2970e46671e1beeef502b702778c5562a (patch)
treefd054978f11e73c3aeb79e56540af07565f987c6 /plugins
parenta64c42c9d45ebc1f1237d78d99b8884ae9aa3c4e (diff)
downloadprosody-1be4a5c2970e46671e1beeef502b702778c5562a.tar.gz
prosody-1be4a5c2970e46671e1beeef502b702778c5562a.zip
mod_http_file_share: Fix reporting of missing files
This just gave an unhelpful 500 error. It would be nice to have some wrapper code that could untangle the embedded filename in the io libs errors.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_http_file_share.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua
index 2191cb30..f8ae05ae 100644
--- a/plugins/mod_http_file_share.lua
+++ b/plugins/mod_http_file_share.lua
@@ -339,9 +339,12 @@ function handle_download(event, path) -- GET /uploads/:slot+filename
return 304;
end
local filename = get_filename(slot_id);
- local handle, ferr = errors.coerce(io.open(filename));
+ local handle, ferr = io.open(filename);
if not handle then
- return ferr or 410;
+ module:log("error", "Could not open file: %s", filename, ferr);
+ -- This can be because the upload slot wasn't used, or the file disappeared
+ -- somehow, or permission issues.
+ return 410;
end
if not filetype then