fix: mime detection bug
All checks were successful
gitea-sync/silk/pipeline/head This commit looks good

This commit is contained in:
DanyLE 2023-01-27 17:00:20 +01:00
parent afd9ffaa07
commit de2ede07e2
2 changed files with 6 additions and 2 deletions

View File

@ -91,7 +91,7 @@ function Router:delegate()
data.controller.main = true data.controller.main = true
views.__main__ = self:call(data) views.__main__ = self:call(data)
if not views.__main__ then if not views.__main__ then
self:info("No view available for action: %s:%s", data.controller.class, data.action) self:debug("No view available for action: %s:%s", data.controller.class, data.action)
return return
end end
-- get all visible routes -- get all visible routes

View File

@ -43,11 +43,15 @@ function std.extra_mime(name)
local ext = utils.ext(name) local ext = utils.ext(name)
local mpath = __ROOT__ .. "/" .. "mimes.json" local mpath = __ROOT__ .. "/" .. "mimes.json"
if WWW_ROOT and not ulib.exists(mpath) then if WWW_ROOT and not ulib.exists(mpath) then
local mpath = WWW_ROOT .. "/" .. "mimes.json" LOG_DEBUG("No extra mimes found in %s", mpath)
mpath = WWW_ROOT .. "/" .. "mimes.json"
LOG_DEBUG("Trying to looking for extra mimes in: %s", mpath)
end end
local xmimes = {} local xmimes = {}
if ulib.exists(mpath) then if ulib.exists(mpath) then
xmimes = JSON.decodeFile(mpath) xmimes = JSON.decodeFile(mpath)
else
LOG_DEBUG("No extra mimes")
end end
if (name:find("Makefile$")) then if (name:find("Makefile$")) then
return "text/makefile", false return "text/makefile", false