diff options
-rw-r--r-- | awall/model.lua | 5 | ||||
-rw-r--r-- | awall/util.lua | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/awall/model.lua b/awall/model.lua index eea654e..b6acd69 100644 --- a/awall/model.lua +++ b/awall/model.lua @@ -602,8 +602,9 @@ end function M.Rule:customtarget() if self.action then - local as = self.action:sub(1, 1) - if as == as:upper() or startswith(self.action, 'custom:') then + if util.startswithupper(self.action) or startswith( + self.action, 'custom:' + ) then return self.action end end diff --git a/awall/util.lua b/awall/util.lua index ad067b7..a7eda03 100644 --- a/awall/util.lua +++ b/awall/util.lua @@ -1,6 +1,6 @@ --[[ Utility module for Alpine Wall -Copyright (C) 2012-2019 Kaarle Ritvanen +Copyright (C) 2012-2020 Kaarle Ritvanen See LICENSE file for license details ]]-- @@ -121,6 +121,12 @@ function M.join(a, sep, b) end +function M.startswithupper(s) + if s == '' then return false end + local c = s:sub(1, 1) + return c == c:upper() +end + function M.quote(s) return '"'..s:gsub('(["\\])', '\\%1')..'"' end |