Software /
code /
prosody-modules
Comparison
mod_http_upload/mod_http_upload.lua @ 2648:4c92e2e897c8
mod_http_upload: Split some long lines [luacheck]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 26 Mar 2017 23:05:31 +0200 |
parent | 2647:d8487d5bd4fb |
child | 2649:abea818eed7b |
comparison
equal
deleted
inserted
replaced
2647:d8487d5bd4fb | 2648:4c92e2e897c8 |
---|---|
34 local file_size_limit = module:get_option_number(module.name .. "_file_size_limit", 1024 * 1024); -- 1 MB | 34 local file_size_limit = module:get_option_number(module.name .. "_file_size_limit", 1024 * 1024); -- 1 MB |
35 | 35 |
36 --- sanity | 36 --- sanity |
37 local parser_body_limit = module:context("*"):get_option_number("http_max_content_size", 10*1024*1024); | 37 local parser_body_limit = module:context("*"):get_option_number("http_max_content_size", 10*1024*1024); |
38 if file_size_limit > parser_body_limit then | 38 if file_size_limit > parser_body_limit then |
39 module:log("warn", "%s_file_size_limit exceeds HTTP parser limit on body size, capping file size to %d B", module.name, parser_body_limit); | 39 module:log("warn", "%s_file_size_limit exceeds HTTP parser limit on body size, capping file size to %d B", |
40 module.name, parser_body_limit); | |
40 file_size_limit = parser_body_limit; | 41 file_size_limit = parser_body_limit; |
41 end | 42 end |
42 | 43 |
43 -- depends | 44 -- depends |
44 module:depends("http"); | 45 module:depends("http"); |
96 local reply = st.reply(stanza); | 97 local reply = st.reply(stanza); |
97 reply:tag("slot", { xmlns = xmlns }); | 98 reply:tag("slot", { xmlns = xmlns }); |
98 | 99 |
99 local random; | 100 local random; |
100 repeat random = uuid(); | 101 repeat random = uuid(); |
101 until lfs.mkdir(join_path(storage_path, random)) or not lfs.attributes(join_path(storage_path, random, filename)) | 102 until lfs.mkdir(join_path(storage_path, random)) |
102 | 103 or not lfs.attributes(join_path(storage_path, random, filenams)) |
103 datamanager.list_append(origin.username, origin.host, module.name, { filename = join_path(storage_path, random, filename), size = filesize, time = os.time() }); | 104 |
105 datamanager.list_append(origin.username, origin.host, module.name, { | |
106 filename = join_path(storage_path, random, filename), size = filesize, time = os.time() }); | |
104 local slot = random.."/"..filename; | 107 local slot = random.."/"..filename; |
105 pending_slots[slot] = origin.full_jid; | 108 pending_slots[slot] = origin.full_jid; |
106 local base_url = module:http_url(); | 109 local base_url = module:http_url(); |
107 local slot_url = url.parse(base_url); | 110 local slot_url = url.parse(base_url); |
108 slot_url.path = url.parse_path(slot_url.path or "/"); | 111 slot_url.path = url.parse_path(slot_url.path or "/"); |