Commit 6453a67e authored by Vladimír Čunát's avatar Vladimír Čunát

modules/http: fix finding the static files

I also verified there's no other usage of the `moduledir` symbol from
lua.  Bug introduced in 2f81b111 (within !298).
parent 619d9dac
Knot Resolver 1.3.1 (2017-06-xx)
================================
Bugfixes
--------
- modules/http: fix finding the static files (bug from 1.3.0)
Knot Resolver 1.3.0 (2017-06-13)
================================
......
......@@ -34,9 +34,10 @@ local mime_types = {
-- Preload static contents, nothing on runtime will touch the disk
local function pgload(relpath, modname)
if not modname then modname = 'http' end
local fp, err = io.open(string.format('%s/%s/%s', moduledir, modname, relpath), 'r')
local mdir = moduledir()
local fp, err = io.open(string.format('%s/%s/%s', mdir, modname, relpath), 'r')
if not fp then
fp, err = io.open(string.format('%s/%s/static/%s', moduledir, modname, relpath), 'r')
fp, err = io.open(string.format('%s/%s/static/%s', mdir, modname, relpath), 'r')
end
if not fp then error(err) end
local data = fp:read('*all')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment