mirror of
https://github.com/bjc/prosody.git
synced 2025-04-03 21:27:38 +03:00
mod_http_file_share: Handle content-type being optional
This commit is contained in:
parent
8485e85c70
commit
0d5bd3974d
1 changed files with 2 additions and 2 deletions
|
@ -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";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue