applications/luci-qos: cope with reorganized L7 patterns
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 10 Jan 2011 00:00:03 +0000 (00:00 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 10 Jan 2011 00:00:03 +0000 (00:00 +0000)
applications/luci-qos/luasrc/model/cbi/qos/qos.lua
applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua

index af481fd3aa8410bfa41fe6266f69a3841b21281d..4891dbbdc81e5c4bd5e10569c8d770f25cd8cf79 100644 (file)
@@ -64,11 +64,12 @@ wa.cbi_add_knownips(dsth)
 l7 = s:option(ListValue, "layer7", translate("Service"))
 l7.rmempty = true
 l7:value("", translate("all"))
-local pats = fs.dir("/etc/l7-protocols")
+local pats = fs.glob("/etc/l7-protocols/*/*.pat")
 if pats then
        for f in pats do
-               if f:sub(-4) == ".pat" then
-                       l7:value(f:sub(1, #f-4))
+               f = f:match("([^/]+)%.pat$")
+               if f then
+                       l7:value(f)
                end
        end
 end
index 503ad10a28c5193db0cb531bd59335c5cf08b7d0..c775ece7309fa9245ea2396c7038ae6d3df3f733 100644 (file)
@@ -50,11 +50,12 @@ wa.cbi_add_knownips(dsth)
 l7 = s:option(ListValue, "layer7", translate("Service"))
 l7.rmempty = true
 l7:value("", translate("all"))
-local pats = fs.dir("/etc/l7-protocols")
+local pats = fs.glob("/etc/l7-protocols/*/*.pat")
 if pats then
        for f in pats do
-               if f:sub(-4) == ".pat" then
-                       l7:value(f:sub(1, #f-4))
+               f = f:match("([^/]+)%.pat$")
+               if f then
+                       l7:value(f)
                end
        end
 end