liquid_feedback_frontend
view app/main/index/document_file.lua @ 1859:02c34183b6df
Fixed wrong filename in INSTALL file
author | bsw |
---|---|
date | Tue Nov 28 18:54:51 2023 +0100 (17 months ago) |
parents | ad6048ec3432 |
children |
line source
1 if not config.document_dir then
2 return execute.view { module = "index", view = "404" }
3 end
5 local filename = param.get("filename")
7 local file = io.open(encode.file_path(config.document_dir, filename))
9 if not file then
10 return execute.view { module = "index", view = "404" }
11 end
13 if param.get("inline") then
14 request.add_header("Content-disposition", "inline; filename=" .. filename)
15 else
16 request.add_header("Content-disposition", "attachment; filename=" .. filename)
17 end
19 local data = file:read("*a")
21 slot.set_layout(nil, content_type)
22 slot.put_into("data", data)