aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_http_file_share.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-01-27 09:47:21 +0100
committerKim Alvefur <zash@zash.se>2021-01-27 09:47:21 +0100
commit5a99373c078f003ab3808fe7f3209052327b10ae (patch)
tree279a61103afbe91cea2be4489ccf9ad3b4ff7147 /plugins/mod_http_file_share.lua
parent3ab51f686468eac1693b611d0526b20fed6bcd6e (diff)
downloadprosody-5a99373c078f003ab3808fe7f3209052327b10ae.tar.gz
prosody-5a99373c078f003ab3808fe7f3209052327b10ae.zip
mod_http_file_share: Handle content-type being optional
Diffstat (limited to 'plugins/mod_http_file_share.lua')
-rw-r--r--plugins/mod_http_file_share.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua
index 8d3310c9..ad6a633c 100644
--- a/plugins/mod_http_file_share.lua
+++ b/plugins/mod_http_file_share.lua
@@ -109,7 +109,7 @@ function handle_slot_request(event)
local request = st.clone(stanza.tags[1], true);
local filename = request.attr.filename;
local filesize = tonumber(request.attr.size);
- local filetype = request.attr["content-type"];
+ local filetype = request.attr["content-type"] or "application/octet-stream";
local uploader = jid.bare(stanza.attr.from);
local may, why_not = may_upload(uploader, filename, filesize, filetype);
@@ -216,7 +216,7 @@ function handle_download(event, path) -- GET /uploads/:slot+filename
end
response.headers.last_modified = last_modified;
response.headers.content_length = slot.attr.size;
- response.headers.content_type = slot.attr["content-type"];
+ response.headers.content_type = slot.attr["content-type"] or "application/octet-stream";
response.headers.content_disposition = string.format("attachment; filename=%q", slot.attr.filename);
response.headers.cache_control = "max-age=31556952, immutable";