luci-base: fix dispacher fail 1814/head
authorAnsuel Smith <ansuelsmth@gmail.com>
Sun, 20 May 2018 17:51:33 +0000 (19:51 +0200)
committerAnsuel Smith <ansuelsmth@gmail.com>
Wed, 23 May 2018 00:52:08 +0000 (02:52 +0200)
http.getenv("SCRIPT_NAME") fail if it's not provided. This can happen in the login screen when we don't have any script to load.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
modules/luci-base/luasrc/dispatcher.lua

index 45e1e308f8f6ddebddbc7ee7534e1f677443d9e6..2c58b0ab3d9220d76f7b0a1e7196b0da622949f6 100644 (file)
@@ -358,7 +358,7 @@ function dispatch(request)
                        elseif key == "REQUEST_URI" then
                                return build_url(unpack(ctx.requestpath))
                        elseif key == "FULL_REQUEST_URI" then
-                               local url = { http.getenv("SCRIPT_NAME"), http.getenv("PATH_INFO") }
+                               local url = { http.getenv("SCRIPT_NAME") or "" , http.getenv("PATH_INFO") }
                                local query = http.getenv("QUERY_STRING")
                                if query and #query > 0 then
                                        url[#url+1] = "?"