* Fixed dispatching regex
[project/luci.git] / libs / web / luasrc / dispatcher.lua
index 202e073..14801c6 100644 (file)
@@ -34,9 +34,6 @@ local tree = {nodes={}}
 -- Index table
 local index = {}
 
--- Indexdump
-local indexcache = "/tmp/.luciindex"
-
 -- Global request object
 request = {}
 
@@ -83,7 +80,7 @@ function httpdispatch()
        local pathinfo = luci.http.env.PATH_INFO or ""
        local c = tree
 
-       for s in pathinfo:gmatch("([%w_]+)") do
+       for s in pathinfo:gmatch("([%w-]+)") do
                table.insert(request, s)
        end
 
@@ -223,11 +220,18 @@ function createtree()
        if not built_index then
                createindex()
        end
+       
+       require("luci.i18n")
 
        for k, v in pairs(index) do
                luci.util.updfenv(v, _M)
                luci.util.extfenv(v, "_NAME", k)
-               pcall(v)
+               
+               local stat, err = pcall(v)
+               if not stat then
+                       error500(err)   
+                       os.exit(1)
+               end
        end
        
        built_tree = true